I think (although I haven''t tried it), that you want the :scope option
to acts_as_list. Something like:
belongs_to :article
belongs_to :column
acts_as_list :scope => ''column_id=#{column_id} AND
article_id=#{article_id}''
should do it. It''s not clear from the docs whether or not the Column
class, or table, actually needs to exist, but I''d imagine not.
--
Alex
Joe Black wrote:> I''ve ran into a problem when using acts_as_list for acticle
blocks.
>
> An app I''m working on allows you to create article blocks and
arrange
> them on the page using a list and manipulate their order using the
> instance methods of acts_as_list. (higher, lower, etc)
>
> This worked fine until I started using a 2 column layout. Each entry
> has a column and a position now. So an article could be in column 1
> position 1, and another could be in column 2 position 1. There
doesn''t
> seem to be a way to treat each column as a seperate list short of duping
> the table into two(not what i want to do).
>
> I''ve tried a few things with the order string on the acts_as_list
> decleration but it doesnt seem to work. If i put everything in one
> column, then move something from the middle of that column over to the
> other column, then move the item below that one up one, it doesnt move
> unless I tell it to move up two, because its still compensating for the
> gap that opened up.
>
> Any suggestions?
>
> Thanks ahead of time!
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails