Dmitry Yakovkin
2007-Apr-29 20:54 UTC
acts_as_list with :scope - how do I move items to a different list?
Hi, I have in my simplistic app: class Album has_many :pics, :order => :position end class Pic belongs_to :album acts_as_list :scope => ::album end It all works fine when creating a new pic from the forms. But, when trying to move a pic between albums, the album changes Ok, but no matter what I do the position attribute stays the same and the list navigation is broken. So far, I''ve tried "newalbum.pics << @pic", "@pic.album = newalbum", "newalbum.pics.insert @pic". What am I doing wrong? TIA, Dmitry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
tonypm
2007-May-01 06:08 UTC
Re: acts_as_list with :scope - how do I move items to a different list?
This worked for me. @pic.destroy @album = Pic.new(params[:pic]) but there may be a better way. tonypm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---