instance method
reorder
Ruby on Rails 4.0.13
Since v3.0.20Signature
reorder(*args)
Replaces any existing order defined on the relation with the specified order.
User.order('email DESC').reorder('id ASC') # generated SQL has 'ORDER BY id ASC'
Subsequent calls to order on the same relation will be appended. For example:
User.order('email DESC').reorder('id ASC').order('name ASC')
generates a query with ‘ORDER BY id ASC, name ASC’.
Parameters
-
argsrest
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 310
def reorder(*args)
check_if_method_has_arguments!("reorder", args)
spawn.reorder!(*args)
end
Defined in activerecord/lib/active_record/relation/query_methods.rb line 310
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::QueryMethods