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/lib | |
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/lib')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index d2065d701f..05091654c0 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -277,13 +277,14 @@ module ActiveRecord type = (reflection.collection? ? :collection : :one_to_one) + # remove_possible_method :pirate_attributes= + # # def pirate_attributes=(attributes) # assign_nested_attributes_for_one_to_one_association(:pirate, attributes, mass_assignment_options) # end class_eval <<-eoruby, __FILE__, __LINE__ + 1 - if method_defined?(:#{association_name}_attributes=) - remove_method(:#{association_name}_attributes=) - end + remove_possible_method(:#{association_name}_attributes=) + def #{association_name}_attributes=(attributes) assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes, mass_assignment_options) end |