diff options
author | Aaron Christy <aaron@edgecase.com> | 2011-10-15 19:53:36 -0400 |
---|---|---|
committer | Aaron Christy <aaron@edgecase.com> | 2011-10-17 13:29:11 -0400 |
commit | 8510a0bb5a8a65e4bc067ee5a7d98aae965b47a5 (patch) | |
tree | b8f3d94109b117a2b492543b0b0aac96c78289b7 /activerecord/test | |
parent | 098c95abcb2b101bde0d55ddd5e348fda0ec8f49 (diff) | |
download | rails-8510a0bb5a8a65e4bc067ee5a7d98aae965b47a5.tar.gz rails-8510a0bb5a8a65e4bc067ee5a7d98aae965b47a5.tar.bz2 rails-8510a0bb5a8a65e4bc067ee5a7d98aae965b47a5.zip |
Exclude _destroy parameter in :all_blank check (issue #2937)
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/nested_attributes_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index 67a9ed6cd8..2ae9cb4888 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -45,6 +45,14 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase end end + def test_should_not_build_a_new_record_using_reject_all_even_if_destroy_is_given + pirate = Pirate.create!(:catchphrase => "Don' botharrr talkin' like one, savvy?") + pirate.birds_with_reject_all_blank_attributes = [{:name => '', :color => '', :_destroy => '0'}] + pirate.save! + + assert pirate.birds_with_reject_all_blank.empty? + end + def test_should_not_build_a_new_record_if_reject_all_blank_returns_false pirate = Pirate.create!(:catchphrase => "Don' botharrr talkin' like one, savvy?") pirate.birds_with_reject_all_blank_attributes = [{:name => '', :color => ''}] |