transaction in rails code example
Example: rails transactions
def transfer_money ActiveRecord::Base.transaction do john.update!(money: john.money + 100) ted.update!(money: ted.money - 100) end end
def transfer_money ActiveRecord::Base.transaction do john.update!(money: john.money + 100) ted.update!(money: ted.money - 100) end end