Class: DataMapper::MasterSlaveAdapter::Middleware::WriteUnbinding
- Inherits:
-
Object
- Object
- DataMapper::MasterSlaveAdapter::Middleware::WriteUnbinding
- Defined in:
- lib/data_mapper/master_slave_adapter/middleware/write_unbinding.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, name = :default) ⇒ WriteUnbinding
constructor
A new instance of WriteUnbinding.
Constructor Details
#initialize(app, name = :default) ⇒ WriteUnbinding
Returns a new instance of WriteUnbinding.
15 16 17 18 |
# File 'lib/data_mapper/master_slave_adapter/middleware/write_unbinding.rb', line 15 def initialize(app, name = :default) @app = app @name = name.to_sym end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/data_mapper/master_slave_adapter/middleware/write_unbinding.rb', line 20 def call(env) @app.call(env) ensure adapter = DataMapper.repository(@name).adapter adapter.reset_binding if adapter.respond_to?(:reset_binding) end |