diff options
author | Gabriel Sobrinho & Ricardo Henrique <gabriel.sobrinho+ricardo.henrique@code5.io> | 2012-11-07 15:41:36 -0200 |
---|---|---|
committer | Gabriel Sobrinho <gabriel.sobrinho@gmail.com> | 2012-11-07 16:19:43 -0200 |
commit | 58e48d5292242f000dc8a87fdbb1c0ccdcf286d8 (patch) | |
tree | 78c85ad7d10d905c1b78b2bfbfb2614271c6f155 /activerecord/lib | |
parent | e41d78ce221b2ca84cc260e20f3813eaace586b3 (diff) | |
download | rails-58e48d5292242f000dc8a87fdbb1c0ccdcf286d8.tar.gz rails-58e48d5292242f000dc8a87fdbb1c0ccdcf286d8.tar.bz2 rails-58e48d5292242f000dc8a87fdbb1c0ccdcf286d8.zip |
Fix accepts_nested_attributes for child classes
Closes GH-8131
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 |