aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations_test.rb
diff options
context:
space:
mode:
authorKelsey Schlarman <kschlarman@gmail.com>2014-01-21 18:19:51 -0800
committerKelsey Schlarman <kschlarman@gmail.com>2014-01-21 18:24:28 -0800
commit43675f014c8d0913650823a5a3e92c8555a3caed (patch)
tree62d9b77acad1b82d28906983cea75360b7a70041 /activerecord/test/cases/associations_test.rb
parenta4ce0659433cc83c5b098c4e900b5214787e99b0 (diff)
downloadrails-43675f014c8d0913650823a5a3e92c8555a3caed.tar.gz
rails-43675f014c8d0913650823a5a3e92c8555a3caed.tar.bz2
rails-43675f014c8d0913650823a5a3e92c8555a3caed.zip
Calling reset on a collection association should unload the assocation
Need to define #reset on CollectionProxy.
Diffstat (limited to 'activerecord/test/cases/associations_test.rb')
-rw-r--r--activerecord/test/cases/associations_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb
index 48e6fc5cd4..f663b5490c 100644
--- a/activerecord/test/cases/associations_test.rb
+++ b/activerecord/test/cases/associations_test.rb
@@ -255,6 +255,15 @@ class AssociationProxyTest < ActiveRecord::TestCase
assert_equal man, man.interests.where("1=1").first.man
end
end
+
+ def test_reset_unloads_target
+ david = authors(:david)
+ david.posts.reload
+
+ assert david.posts.loaded?
+ david.posts.reset
+ assert !david.posts.loaded?
+ end
end
class OverridingAssociationsTest < ActiveRecord::TestCase