aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2013-06-18 15:44:08 -0700
committerJon Leighton <j@jonathanleighton.com>2013-06-18 15:44:08 -0700
commit2b817a5e89ac0e7aeb894a40ae7151a0cf3cef16 (patch)
tree8948c673b922e14008623dfb7d27692d5fa18d5b /activerecord/test/cases
parent353a398bee68c5ea99d76ac7601de0a5fef6f4a5 (diff)
parent2b73f780ffa52baba09511b2db753f0fde574c14 (diff)
downloadrails-2b817a5e89ac0e7aeb894a40ae7151a0cf3cef16.tar.gz
rails-2b817a5e89ac0e7aeb894a40ae7151a0cf3cef16.tar.bz2
rails-2b817a5e89ac0e7aeb894a40ae7151a0cf3cef16.zip
Merge pull request #10566 from neerajdotname/10509d
do not load all child records for inverse case
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/inverse_associations_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb
index b1f0be3204..993e7294cf 100644
--- a/activerecord/test/cases/associations/inverse_associations_test.rb
+++ b/activerecord/test/cases/associations/inverse_associations_test.rb
@@ -401,6 +401,14 @@ class InverseHasManyTests < ActiveRecord::TestCase
assert_equal man.name, man.interests.find(interest.id).man.name, "The name of the man should match after the child name is changed"
end
+ def test_find_on_child_instance_with_id_should_not_load_all_child_records
+ man = Man.create!
+ interest = Interest.create!(man: man)
+
+ man.interests.find(interest.id)
+ refute man.interests.loaded?
+ end
+
def test_raise_record_not_found_error_when_invalid_ids_are_passed
man = Man.create!