I would like to specify a default sort order in my model.
So that when I preform a find(:all, ...)
without an :order
parameter it defaults to the order specified in the model, but specifying an :order
will override the default.
I would like to specify a default sort order in my model.
So that when I preform a find(:all, ...)
without an :order
parameter it defaults to the order specified in the model, but specifying an :order
will override the default.
You can use default_scope: http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001828