Ordering of subsets in a model

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.


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
item belongs to. Each menu has another list.

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

Muchos gracias! :smiley:


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs