Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
nested transactions requires_new api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html
User.transaction do
User.create(name: 'Kotori')
User.transaction(requires_new: true) 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