diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_through_association.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index c1fc16b0ed..0b00132ad9 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -42,7 +42,7 @@ module ActiveRecord protected def create_record(attrs, force = true) ensure_not_nested - ensure_owner_is_not_new + ensure_owner_is_persisted! transaction do object = @reflection.klass.new(attrs) @@ -67,7 +67,7 @@ module ActiveRecord def insert_record(record, force = true, validate = true) ensure_not_nested - unless record.persisted? + if record.new_record? if force record.save! else |