aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorVishal Telangre <the@vishaltelangre.com>2019-05-08 18:11:43 +0530
committerVishal Telangre <the@vishaltelangre.com>2019-05-10 01:37:12 +0530
commitbbcd707aefe5da137137a8deb13908ec9a7db77d (patch)
tree7d99cb9364e5130001cdacea7c267dbcd60d46da /activerecord/lib/active_record
parent669b52d2965f50f1f3f99f1c54677a328191c69d (diff)
downloadrails-bbcd707aefe5da137137a8deb13908ec9a7db77d.tar.gz
rails-bbcd707aefe5da137137a8deb13908ec9a7db77d.tar.bz2
rails-bbcd707aefe5da137137a8deb13908ec9a7db77d.zip
Fix: ActiveRecord::RecordInvalid is not raised when an associated record fails to #save! due to uniqueness validation failure
Add tests Fix tests failing due to introduction of uniquness rule added to Book model
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/autosave_association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb
index 8d89e7d84a..2d4f0ad77e 100644
--- a/activerecord/lib/active_record/autosave_association.rb
+++ b/activerecord/lib/active_record/autosave_association.rb
@@ -411,7 +411,7 @@ module ActiveRecord
saved = record.save(validate: false)
end
- raise ActiveRecord::Rollback unless saved
+ raise(RecordInvalid.new(association.owner)) unless saved
end
end
end