I have an array of objects in Ruby on Rails. I want to sort the array by an attribute of the object. Is it possible?
@model_name.sort! { |a,b| a.attribute <=> b.attribute }