1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Merge pull request #43816 from jpawlyn/fix-one-and-many-on-relation"

This reverts commit 9ae41cbe77, reversing
changes made to e4547052b9.

CI is broken.
This commit is contained in:
Rafael Mendonça França 2021-12-10 17:49:29 +00:00
parent 9ae41cbe77
commit 1410c3fd1d
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 3 additions and 13 deletions

View file

@ -33,6 +33,7 @@ module ActiveRecord
@delegate_to_klass = false
@future_result = nil
@records = nil
@limited_count = nil
end
def initialize_copy(other)
@ -698,6 +699,7 @@ module ActiveRecord
@offsets = @take = nil
@cache_keys = nil
@records = nil
@limited_count = nil
self
end
@ -972,7 +974,7 @@ module ActiveRecord
end
def limited_count
limit_value ? count : limit(2).count
@limited_count ||= limit_value ? count : limit(2).count
end
end
end

View file

@ -1216,18 +1216,6 @@ class RelationTest < ActiveRecord::TestCase
assert_predicate posts, :loaded?
end
def test_one_with_destroy
posts = Post.all
assert_queries(1) do
assert_not posts.one?
end
posts.where.not(id: Post.first).destroy_all
assert_equal 1, posts.size
assert posts.one?
end
def test_to_a_should_dup_target
posts = Post.all