diff options
author | Matt Jones <al2o3cr@gmail.com> | 2012-01-09 11:20:52 -0500 |
---|---|---|
committer | Matt Jones <al2o3cr@gmail.com> | 2012-01-09 11:20:52 -0500 |
commit | 23f8c635c0c8c9f6fbe810766104a4fa9f6794d4 (patch) | |
tree | c2ad27862386736f446bdf81b956d13784e3e4c9 /activerecord/lib/active_record | |
parent | d7aff288b145540bc528b97eb306b42c3a60d31b (diff) | |
download | rails-23f8c635c0c8c9f6fbe810766104a4fa9f6794d4.tar.gz rails-23f8c635c0c8c9f6fbe810766104a4fa9f6794d4.tar.bz2 rails-23f8c635c0c8c9f6fbe810766104a4fa9f6794d4.zip |
add documentation explaining reorder behavior
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index c281bead0d..bfb5c27578 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -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? |