diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 18324cf3c6..3aa38dcf78 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -455,13 +455,13 @@ module ActiveRecord if offset_value && (ids.size - offset_value < expected_size) expected_size = ids.size - offset_value else - ids = ids.first(expected_size) unless self.values[:order] + ids = ids.first(expected_size) if order_values.empty? end result = where(primary_key => ids).to_a if result.size == expected_size - return result if self.values[:order] + return result if order_values.present? records_by_id = result.index_by(&:id) ids.collect { |id| records_by_id[id.to_i] }.compact else |