I am facing issues while using sort or sort_by in my presenter and controller. It says undefined method 'sort_by' .
Does it belong to any particular class? I have looked it up online but I am not able to find anything concrete.
Can any one shed light on this?
Here is my presenter code-
def sortDocument()
@list.sort do |a, b|
(b.published_date <=> a.published_date) ||
a.display_name <=> b.display_name
@list
end
and alternatively
def sortDocument()
@list.sort_by!{ |m| m.published_date }
end
Aucun commentaire:
Enregistrer un commentaire