diff options
author | José Valim <jose.valim@gmail.com> | 2010-11-28 16:55:48 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-28 16:55:53 +0100 |
commit | e444439fe28f873c783a4b99b1c9f29a7405dd0d (patch) | |
tree | 75ac578b9a756cabf8af1d08e969d3623f440610 /activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | |
parent | 31906eecdf7bffc2203379c5d40f1bb77fb35858 (diff) | |
download | rails-e444439fe28f873c783a4b99b1c9f29a7405dd0d.tar.gz rails-e444439fe28f873c783a4b99b1c9f29a7405dd0d.tar.bz2 rails-e444439fe28f873c783a4b99b1c9f29a7405dd0d.zip |
Partialy revert f1c13b0dd7b22b5f6289ca1a09f1d7a8c7c8584b
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index 2c72fd0004..f6f291a039 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -34,7 +34,7 @@ module ActiveRecord end def insert_record(record, force = true, validate = true) - unless record.persisted? + if record.new_record? if force record.save! else @@ -113,7 +113,7 @@ module ActiveRecord private def create_record(attributes, &block) # Can't use Base.create because the foreign key may be a protected attribute. - ensure_owner_is_not_new + ensure_owner_is_persisted! if attributes.is_a?(Array) attributes.collect { |attr| create(attr) } else |