Module: DataMapper::Transaction::Model

Defined in:
lib/dm-transactions.rb

Overview

module Repository

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



360
361
362
# File 'lib/dm-transactions.rb', line 360

def self.included(mod)
  mod.descendants.each { |model| model.extend self }
end

Instance Method Details

#transactionAdapters::Transaction a new Adapters::Transaction with all Repositories of the class of this Resource added.

Produce a new Transaction for this Resource class

Returns:

  • (Adapters::Transaction a new Adapters::Transaction with all Repositories of the class of this Resource added.)

    Adapters::Transaction a new Adapters::Transaction with all Repositories of the class of this Resource added.



371
372
373
374
# File 'lib/dm-transactions.rb', line 371

def transaction
  transaction = Transaction.new(self)
  transaction.commit { |block_args| yield(*block_args) }
end