From 2eb6b9dd0ba5049ee3a94f2f7ec7aa2fadd69dfc Mon Sep 17 00:00:00 2001 From: Miguel Grazziotin Date: Fri, 5 Jun 2015 17:18:03 -0300 Subject: do not change the order of the result if the object was already ordered by the user via :order clause --- activerecord/lib/active_record/relation/finder_methods.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3