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 commit9ae41cbe77
, reversing changes made toe4547052b9
. CI is broken.
This commit is contained in:
parent
9ae41cbe77
commit
1410c3fd1d
2 changed files with 3 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue