<< TransparentHashAccess | Index | NamedAccess >>
Only tested with postgres backend
require 'odba' class Container attr_accessor :foo end class Foo include ODBA::Persistable attr_accessor :bar end ODBA.storage.dbi = DBI.connect('DBI:pg:test', 'hwyss', '') container = Container.new container.foo = foo = ODBA.cache.fetch_named('foo', container) { Foo.new } foo.bar = 'before transaction' foo.odba_store begin ODBA.transaction { foo.bar = 'after transaction' foo.odba_store raise 'some silly error' } rescue RuntimeError end container.foo.bar
returns
'before transaction'