Created
December 11, 2017 21:29
-
-
Save pragtobgists/0ab874d6e707c85d95f7e27cb2e8ee64 to your computer and use it in GitHub Desktop.
Taken from the nested transaction section of api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User.transaction do | |
User.create(name: 'Kotori') | |
User.transaction do | |
User.create(name: 'Nemu') | |
raise ActiveRecord::Rollback | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment