Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #8145 from sobrinho/master

Add test to avoid regression of 58e48d5
  • Loading branch information...
commit 772883c59078484dc8990ffbc509e249e22a6c84 2 parents f8ca941 + 6876f4a
Rafael Mendonça França rafaelfranca authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 activerecord/test/cases/nested_attributes_test.rb
11 activerecord/test/cases/nested_attributes_test.rb
View
@@ -185,6 +185,17 @@ def parrot_attributes=(attrs)
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
Please sign in to comment.
Something went wrong with that request. Please try again.