For example, I would like to sort by game_date, and then if the date is the same, sort it by team? What would be the best way to do this?
@teams = @user.tea
For those looking to sort an array containing two different objects w/ a differently named date field, you can do this with an attribute alias method in the model.
note: using .sort_by! destructively doesn't work.
def release_date
self.publish_date
end
@grid_elements = @news + @albums
@grid_elements = @grid_elements.sort_by(&:release_date)