Module: ROM::SQL::Commands::Transaction Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adds transaction interface to commands
Instance Method Summary collapse
-
#transaction(options = {}, &block) ⇒ ROM::Commands::Result::Success, ROM::Commands::Result::Failure
Start a transaction.
Instance Method Details
#transaction(options = {}, &block) ⇒ ROM::Commands::Result::Success, ROM::Commands::Result::Failure
Start a transaction
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rom/sql/commands/transaction.rb', line 19 def transaction( = {}, &block) result = relation.dataset.db.transaction(, &block) if result ROM::Commands::Result::Success.new(result) else ROM::Commands::Result::Failure.new(result) end rescue ROM::CommandError => e ROM::Commands::Result::Failure.new(e) end |