aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/nested_attributes_test.rb
diff options
context:
space:
mode:
authorGabriel Sobrinho & Ricardo Henrique <gabriel.sobrinho+ricardo.henrique@code5.io>2012-11-08 15:19:44 -0200
committerGabriel Sobrinho <gabriel.sobrinho@gmail.com>2012-11-08 15:19:44 -0200
commit6876f4a787249146517b01efaaa0a5b27ee0350b (patch)
tree09e246db84c25e04bb3d6fb22f3bfacc5f30baaf /activerecord/test/cases/nested_attributes_test.rb
parent9abec81622473d9fe446df8385f9f483f5e4cd24 (diff)
downloadrails-6876f4a787249146517b01efaaa0a5b27ee0350b.tar.gz
rails-6876f4a787249146517b01efaaa0a5b27ee0350b.tar.bz2
rails-6876f4a787249146517b01efaaa0a5b27ee0350b.zip
Add test to avoid regression of 58e48d5292242f000dc8a87fdbb1c0ccdcf286d8
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 9674f2ce94..3f08f9ea4d 100644
--- a/activerecord/test/cases/nested_attributes_test.rb
+++ b/activerecord/test/cases/nested_attributes_test.rb
@@ -185,6 +185,17 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
assert_equal "James", mean_pirate.parrot.name
assert_equal "blue", mean_pirate.parrot.color
end
+
+ def test_accepts_nested_attributes_for_can_be_overridden_in_subclasses
+ 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