Ordering of subsets in a model


#1

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.


#2

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.


#3

Beautiful. I had a feeling I was overlooking something that would do
exactly what I wanted.

Muchos gracias! :smiley:

Mathias.