Flowdock
method

order

Importance_2
v3.2.8 - Show latest stable - 2 notes - Class: ActiveRecord::QueryMethods
order(*args) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
March 27, 2012
2 thanks

Reorder

If you want to override previously set order (even through default_scope), use reorder() instead.

E.g.

User.order('id ASC').reorder('name DESC')

would ignore ordering by id completely

January 12, 2014
0 thanks

using hash as order

order can be specified as a hash, e.g.:

order(id: :desc)

This will prevent “ambiguous column” errors when the order is used with joins or includes.