Method: DbCharmer.with_controller
- Defined in:
- lib/db_charmer/force_slave_reads.rb
.with_controller(controller) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/db_charmer/force_slave_reads.rb', line 33 def self.with_controller(controller) raise ArgumentError, "No block given" unless block_given? logger.debug("Setting current controller for db_charmer: #{controller.class.name}") self.current_controller = controller yield ensure logger.debug('Clearing current controller for db_charmer') self.current_controller = nil end |