diff options
Diffstat (limited to 'activerecord/test/models/company.rb')
-rw-r--r-- | activerecord/test/models/company.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 6219f57fa1..d4d5275b78 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -150,6 +150,16 @@ class Client < Company throw :abort if throw_on_save end + attr_accessor :rollback_on_save + after_save do + raise ActiveRecord::Rollback if rollback_on_save + end + + attr_accessor :rollback_on_create_called + after_rollback(on: :create) do |client| + client.rollback_on_create_called = true + end + class RaisedOnDestroy < RuntimeError; end attr_accessor :raise_on_destroy before_destroy do |