search for: ordered_by_name

Displaying 1 result from an estimated 1 matches for "ordered_by_name".

2008 Apr 04
0
named_scope and ordering
...ASC'' according to the first scope ''marked'' So what are the options? # orders_controller.rb def index @marked = Order.marked.find(:all, :order => ''name ASC'') end No, that feels like bleeding model code into the controller. # order.rb named_scope :ordered_by_name, :order => ''name ASC'' # orders_controller.rb @marked = Order.marked.ordered_by_name Still my best idea yet, but also quite verbose. It would be nice if you could define a default order for a named_scope and then you could use ''ordered_by_''-scopes to override...