KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Given the following AR models, I would like to sort users alphabetically by last name when given a handle to a task: #user has_many :assignments has_many :tasks, :through => :assignments #assignment belongs_to :task belongs_to :user #task has_many :assignments has_many :users, :through => :assignments I would like to get a task then navigation to its assigned users, and sort the user list alphabetically . I keep thinking that I should be able to add the :order clause to has_many :users, :through => :assignments like this: #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 a task?
Tags (comma-separated)
Save Edits
Cancel