diff options
author | Miguel Grazziotin <miguelgraz@gmail.com> | 2015-06-05 17:18:03 -0300 |
---|---|---|
committer | Miguel Grazziotin <miguelgraz@gmail.com> | 2015-06-05 17:18:03 -0300 |
commit | 2eb6b9dd0ba5049ee3a94f2f7ec7aa2fadd69dfc (patch) | |
tree | bb9e61043f89d41353ea7a575e722ea213581394 /activerecord/lib/active_record | |
parent | 4e63a7b4b051aa8dc7ae53f46ea27cf421863561 (diff) | |
download | rails-2eb6b9dd0ba5049ee3a94f2f7ec7aa2fadd69dfc.tar.gz rails-2eb6b9dd0ba5049ee3a94f2f7ec7aa2fadd69dfc.tar.bz2 rails-2eb6b9dd0ba5049ee3a94f2f7ec7aa2fadd69dfc.zip |
do not change the order of the result if the object was already ordered by the user via :order clause
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 48a7d15ea8..a0e1420055 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -459,6 +459,7 @@ module ActiveRecord end if result.size == expected_size + return result if self.values[:order] records_by_id = result.index_by(&:id) ids.first(expected_size).collect { |id| records_by_id[id.to_i] } else |