diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-08 08:17:43 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-08 08:17:43 -0800 |
commit | b02556708cd0c3de3d56bd94c624ade44cbce14a (patch) | |
tree | 78c85ad7d10d905c1b78b2bfbfb2614271c6f155 /activerecord/test/cases/nested_attributes_test.rb | |
parent | e41d78ce221b2ca84cc260e20f3813eaace586b3 (diff) | |
parent | 58e48d5292242f000dc8a87fdbb1c0ccdcf286d8 (diff) | |
download | rails-b02556708cd0c3de3d56bd94c624ade44cbce14a.tar.gz rails-b02556708cd0c3de3d56bd94c624ade44cbce14a.tar.bz2 rails-b02556708cd0c3de3d56bd94c624ade44cbce14a.zip |
Merge pull request #8138 from sobrinho/3-2-stable
Fix accepts_nested_attributes for child classes
Diffstat (limited to 'activerecord/test/cases/nested_attributes_test.rb')
-rw-r--r-- | activerecord/test/cases/nested_attributes_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index 16b1eb040e..0b678618e8 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -172,6 +172,17 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase man.interests_attributes = [{:id => interest.id, :topic => 'gardening'}] assert_equal man.interests.first.topic, man.interests[0].topic end + + def test_something + Pirate.accepts_nested_attributes_for(:parrot) + + mean_pirate_class = Class.new(Pirate) do + accepts_nested_attributes_for :parrot + end + mean_pirate = mean_pirate_class.new + mean_pirate.parrot_attributes = { :name => "James" } + assert_equal "James", mean_pirate.parrot.name + end end class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase |