views:

61

answers:

2

I've got a form with nested objects as described here:

http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes

It's working fine, but I need to sort the nested objects in the form by their "name" attribute so they are listed in alphabetical order.

Any ideas?

+2  A: 

Set a default ordering for the association, for example:

has_many :children, :order => "name"
Alex Reisner
A: 

I ended up just setting the sort order on the default scope of the nested model:

default_scope :order => 'name'
Danger Angell