Alright, I got this table with lots of entries for menus. There''s several menus (with their own model since each menu got some special information). Now, I want to be able to specify the order of the menu entries inside the menu. acts_as_list seems to not quite do the trick since it does ordering "globally" on the whole model and acts_as_nested_set seems like overkill since I''m never going to need more then one menu''s entries at a time. Should I got for acts_as_nested_set or should I simply create my own ordering system with a column and some checks that makes sure no numbers are repeated inside each menu''s entries? I have a feeling there is a nice and good solution lurking out there though. I hope I''m making any sense, kinda late, but I was hoping for some good answers to read tomorrow morning. Thanks! Mathias.
You could use acts_as_list :scope => :menu_id This way the scope for the list is set to be within only the menu that the item belongs to. Each menu has another list. On 5/10/06, Mathias Wittlock <wittlock+rubyonrailslist@gmail.com> wrote:> > Alright, I got this table with lots of entries for menus. There''s > several menus (with their own model since each menu got some special > information). Now, I want to be able to specify the order of the menu > entries inside the menu. acts_as_list seems to not quite do the trick > since it does ordering "globally" on the whole model and > acts_as_nested_set seems like overkill since I''m never going to need > more then one menu''s entries at a time. > > Should I got for acts_as_nested_set or should I simply create my own > ordering system with a column and some checks that makes sure no > numbers are repeated inside each menu''s entries? I have a feeling > there is a nice and good solution lurking out there though. > > I hope I''m making any sense, kinda late, but I was hoping for some > good answers to read tomorrow morning. > > Thanks! > Mathias. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060510/4b586ffe/attachment.html
Beautiful. I had a feeling I was overlooking something that would do exactly what I wanted. Muchos gracias! :D Mathias. On 5/10/06, Liquid <has.sox@gmail.com> wrote:> You could use acts_as_list :scope => :menu_id > > This way the scope for the list is set to be within only the menu that the > item belongs to. Each menu has another list. > > > On 5/10/06, Mathias Wittlock < > wittlock+rubyonrailslist@gmail.com> wrote: > > > Alright, I got this table with lots of entries for menus. There''s > several menus (with their own model since each menu got some special > information). Now, I want to be able to specify the order of the menu > entries inside the menu. acts_as_list seems to not quite do the trick > since it does ordering "globally" on the whole model and > acts_as_nested_set seems like overkill since I''m never going to need > more then one menu''s entries at a time. > > Should I got for acts_as_nested_set or should I simply create my own > ordering system with a column and some checks that makes sure no > numbers are repeated inside each menu''s entries? I have a feeling > there is a nice and good solution lurking out there though. > > I hope I''m making any sense, kinda late, but I was hoping for some > good answers to read tomorrow morning. > > Thanks! > Mathias. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >