diff options
author | Eloy Duran <eloy.de.enige@gmail.com> | 2009-12-15 16:40:02 +0100 |
---|---|---|
committer | Eloy Duran <eloy.de.enige@gmail.com> | 2009-12-28 16:56:31 +0100 |
commit | 9c771a9608f54ebdfcb6fca819c83038489ce50d (patch) | |
tree | 818d29c435d32311a2b02fc990d7be0ac012d0df /activerecord/lib/active_record/nested_attributes.rb | |
parent | ff508640e28914da2b546f6a8c9f215bab201b61 (diff) | |
download | rails-9c771a9608f54ebdfcb6fca819c83038489ce50d.tar.gz rails-9c771a9608f54ebdfcb6fca819c83038489ce50d.tar.bz2 rails-9c771a9608f54ebdfcb6fca819c83038489ce50d.zip |
Make sure to not add autosave callbacks multiple times. [#3575 state:resolved]
This makes sure that, in a HABTM association, only one join record is craeted.
Diffstat (limited to 'activerecord/lib/active_record/nested_attributes.rb')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index ca3110a374..386f0e7ca7 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -235,7 +235,7 @@ module ActiveRecord end reflection.options[:autosave] = true - + add_autosave_association_callbacks(reflection) self.nested_attributes_options[association_name.to_sym] = options if options[:reject_if] == :all_blank @@ -250,8 +250,6 @@ module ActiveRecord assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes) end }, __FILE__, __LINE__ - - add_autosave_association_callbacks(reflection) else raise ArgumentError, "No association found for name `#{association_name}'. Has it been defined yet?" end |