aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index d30756b9c7..18f4580f45 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1100,8 +1100,8 @@ module ActiveRecord
after_callback = <<-end_eval
association = instance_variable_get("@#{association_name}")
-
- if association.respond_to?(:loaded?)
+
+ if association.respond_to?(:loaded?) && association.loaded?
if @new_record_before_save
records_to_save = association
else
@@ -1111,7 +1111,7 @@ module ActiveRecord
association.send(:construct_sql) # reconstruct the SQL queries now that we know the owner's id
end
end_eval
-
+
# Doesn't use after_save as that would save associations added in after_create/after_update twice
after_create(after_callback)
after_update(after_callback)