Skip to content

Instantly share code, notes, and snippets.

@briu
Created April 2, 2020 12:25
Show Gist options
  • Save briu/171e1e789595e1b88b0a170dbb3b3757 to your computer and use it in GitHub Desktop.
Save briu/171e1e789595e1b88b0a170dbb3b3757 to your computer and use it in GitHub Desktop.
transaction
ApplicationRecord.transaction do
user.update(name: "test_user")
order.update(user_id: user.id)
CalculatePayoutJob.perform_later(user, order)
raise ActiveRecord::Rollback if order.errors.present?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment