add documentation explaining reorder behavior

This commit is contained in:
Matt Jones
2012-01-09 11:20:52 -05:00
committed by Vijay Dev
parent 96d4da1719
commit d0915ac2f9

View File

@@ -93,6 +93,16 @@ module ActiveRecord
relation
end
# 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'.
#
def reorder(*args)
return self if args.blank?