Forum: Ruby on Rails Ordering of subsets in a model.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A7736d622f35f8725cc9a0c835d633a3?d=identicon&s=25 Mathias Wittlock (Guest)
on 2006-05-10 03:33
(Received via mailing list)
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.
9d1f5d2d9de70bd9a934f557dc95a406?d=identicon&s=25 Daniel ----- (liquid)
on 2006-05-10 03:39
(Received via mailing list)
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.
A7736d622f35f8725cc9a0c835d633a3?d=identicon&s=25 Mathias Wittlock (Guest)
on 2006-05-10 15:07
(Received via mailing list)
Beautiful. I had a feeling I was overlooking something that would do
exactly what I wanted.

Muchos gracias! :D

Mathias.
This topic is locked and can not be replied to.