sort has_many relationship