aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/nested_attributes_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-08 08:17:43 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-08 08:17:43 -0800
commitb02556708cd0c3de3d56bd94c624ade44cbce14a (patch)
tree78c85ad7d10d905c1b78b2bfbfb2614271c6f155 /activerecord/test/cases/nested_attributes_test.rb
parente41d78ce221b2ca84cc260e20f3813eaace586b3 (diff)
parent58e48d5292242f000dc8a87fdbb1c0ccdcf286d8 (diff)
downloadrails-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.rb11
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