diff options
author | James Le Cuirot <chewi@aura-online.co.uk> | 2010-06-30 23:22:13 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-01 01:06:58 +0200 |
commit | f3fedd7f84c25d1d99a70af1e21e20abb48f100f (patch) | |
tree | 1d367c56060d05ca3fa4c867b37c59660a4b75fa /activerecord/test/cases | |
parent | 57d750edf7c71e001ac314fa188aa1fc6292f8ab (diff) | |
download | rails-f3fedd7f84c25d1d99a70af1e21e20abb48f100f.tar.gz rails-f3fedd7f84c25d1d99a70af1e21e20abb48f100f.tar.bz2 rails-f3fedd7f84c25d1d99a70af1e21e20abb48f100f.zip |
Don't remove scheduled destroys when loading an association. [#4642 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/nested_attributes_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index 3c797076e0..62237f955b 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -489,6 +489,12 @@ module NestedAttributesOnACollectionAssociationTests assert_equal 'Polly', @pirate.send(@association_name).send(:load_target).last.name end + def test_should_not_remove_scheduled_destroys_when_loading_association + @pirate.reload + @pirate.send(association_setter, [{ :id => @child_1.id, :_destroy => '1' }]) + assert @pirate.send(@association_name).send(:load_target).find { |r| r.id == @child_1.id }.marked_for_destruction? + end + def test_should_take_a_hash_with_composite_id_keys_and_assign_the_attributes_to_the_associated_models @child_1.stubs(:id).returns('ABC1X') @child_2.stubs(:id).returns('ABC2X') |