diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2005-10-20 15:05:48 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2005-10-20 15:05:48 +0000 |
commit | 5f0b9369cc857ef007a9b0f573b63225e342e4fd (patch) | |
tree | 73f1ec0d8680d9ba38fe7095fe89a1e4225a3add /activerecord/test | |
parent | 7219e82fe600ff1268b9a89efc7a289ac0108592 (diff) | |
download | rails-5f0b9369cc857ef007a9b0f573b63225e342e4fd.tar.gz rails-5f0b9369cc857ef007a9b0f573b63225e342e4fd.tar.bz2 rails-5f0b9369cc857ef007a9b0f573b63225e342e4fd.zip |
Fix Associations#clear for not-yet-loaded associations (Patrick Lenz)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2695 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/associations_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 47562f9176..2d7ebc2b42 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -566,6 +566,15 @@ class HasManyAssociationsTest < Test::Unit::TestCase assert Client.find_by_id(client_id).nil? end + def test_clearing_without_initial_access + firm = companies(:first_firm) + + firm.clients_of_firm.clear + + assert_equal 0, firm.clients_of_firm.size + assert_equal 0, firm.clients_of_firm(true).size + end + def test_deleting_a_item_which_is_not_in_the_collection force_signal37_to_load_all_clients_of_firm summit = Client.find_first("name = 'Summit'") |