aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_collection.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations/association_collection.rb')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb
index daec8493ac..3d8a23fdca 100644
--- a/activerecord/lib/active_record/associations/association_collection.rb
+++ b/activerecord/lib/active_record/associations/association_collection.rb
@@ -314,7 +314,11 @@ module ActiveRecord
transaction do
delete(@target - other_array)
- concat(other_array - @target)
+
+ unless concat(other_array - @target)
+ raise RecordNotSaved, "Failed to replace #{@reflection.name} because one or more of the "
+ "new records could not be saved."
+ end
end
end