Given the following AR models, I would like to sort users alphabetically by name when defining a task handle:
#user has_many :assignments has_many :tasks, :through => :assignments
I would like to get the task, then go to the assigned users, and sort the list of users alphabetically.
I keep thinking that I should add the :order clause to has_many :users, :through => :assignments as follows:
#task.rb has_many :assignments has_many :users, :through => :assignments, :order => 'last_name, first_name'
however this does not work.
How can I sort users by last_name when given?
ruby-on-rails has-many-through
rswolff Feb 05 '10 at 7:26 2010-02-05 07:26
source share