Method: ODB::Transaction#transaction

Defined in:
lib/odb.rb

#transaction(&block) ⇒ Object



89
90
91
92
93
94
95
96
# File 'lib/odb.rb', line 89

def transaction(&block)
  objects_before = persistent_objects
  self.class.transactions << self
  yield
  self.objects << (persistent_objects - objects_before)
  commit
  self.class.transactions.pop
end