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 :ta
I am using Rails (5.0.0.1) and could make the sort with this syntax in my model Group that has many users through group_users:
# Associations. has_many :group_users has_many :users, -> { order(:name) }, through: :group_users
Adjust the code to your need that will work.