Module: Quiver::Mappers

Defined in:
lib/quiver/mappers.rb

Defined Under Namespace

Modules: ActiveRecordTransaction, MemoryTransaction Classes: RollbackTransaction, Transaction

Class Method Summary collapse

Class Method Details

.transaction(&block) ⇒ Object

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
11
# File 'lib/quiver/mappers.rb', line 3

def self.transaction(&block)
  raise ArgumentError, "#transaction requires a block" unless block_given?

  root_module = self.parent
  adapter_type = root_module::Application.default_adapter_type

  transaction_klass = self.const_get("#{adapter_type.to_s.camelize}Transaction")
  transaction_klass.transaction(root_module, &block)
end