From d7ab5710916f8ee58a970312e9bc9276022fe3a6 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Sun, 26 Nov 2017 10:22:54 -0500 Subject: Revert "Merge pull request #31006 from rails/kamipo/ordinal_methods_should_respect_loaded_records" This reverts commit 0f79ab91150b4cdb6c018530978a3395962c7a02, reversing changes made to d575f7f2e737739302a0e8210d01c10f5d4e2c35. This PR philosophically conflicts with #30800 and Matthew thinks we should hold off merging this until we find concensus. Reverting since we're about to cut a release for 5.2. --- activerecord/lib/active_record/relation.rb | 1 - activerecord/test/cases/finder_test.rb | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index d3b8091665..081ef5771f 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -544,7 +544,6 @@ module ActiveRecord end @records.each(&:readonly!) if readonly_value - @offsets = {} unless @offsets.empty? @loaded = true @records diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 93957ff50f..e936c56ab8 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -691,22 +691,6 @@ class FinderTest < ActiveRecord::TestCase assert_kind_of Array, Topic.last(5) end - def test_first_should_respect_loaded_records - authors = Author.order(:name) - - assert_equal authors(:bob), authors.first - - aaron = authors.create!(name: "Aaron") - - authors.load - - assert_no_queries do - assert_equal aaron, authors.first - assert_equal authors(:bob), authors.second - assert_not_equal authors.first, authors.second - end - end - def test_unexisting_record_exception_handling assert_raise(ActiveRecord::RecordNotFound) { Topic.find(1).parent -- cgit v1.2.3