From 097240f60215b866d24aebd02cc4159bdc6e7451 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 8 Sep 2010 11:09:27 -0400 Subject: reject_id option should be respected while using nested_attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#5579 state:resolved] Signed-off-by: José Valim --- activerecord/test/cases/nested_attributes_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index 9823d7aa0e..62e073ba8c 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -114,6 +114,15 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase pirate.ship_attributes = { :name => 'Hello Pearl' } assert_difference('Ship.count') { pirate.save! } end + + def test_reject_if_with_a_proc_which_returns_true_always + Pirate.accepts_nested_attributes_for :ship, :reject_if => proc {|attributes| true } + pirate = Pirate.new(:catchphrase => "Stop wastin' me time") + ship = pirate.create_ship(:name => 's1') + pirate.update_attributes({:ship_attributes => { :name => 's2', :id => ship.id } }) + assert_equal 's1', ship.reload.name + end + end class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase -- cgit v1.2.3