Module: DbCharmer::ActionController::ForceSlaveReads::InstanceMethods

Defined in:
lib/db_charmer/action_controller/force_slave_reads.rb

Constant Summary collapse

DISPATCH_METHOD =
(DbCharmer.rails3?) ? :process_action : :perform_action

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



40
41
42
# File 'lib/db_charmer/action_controller/force_slave_reads.rb', line 40

def self.included(base)
  base.alias_method_chain DISPATCH_METHOD, :forced_slave_reads
end

Instance Method Details

#dont_force_slave_reads!Object



48
49
50
# File 'lib/db_charmer/action_controller/force_slave_reads.rb', line 48

def dont_force_slave_reads!
  @db_charmer_force_slave_reads = false
end

#force_slave_reads!Object



44
45
46
# File 'lib/db_charmer/action_controller/force_slave_reads.rb', line 44

def force_slave_reads!
  @db_charmer_force_slave_reads = true
end

#force_slave_reads?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/db_charmer/action_controller/force_slave_reads.rb', line 52

def force_slave_reads?
  @db_charmer_force_slave_reads || self.class.force_slave_reads_action?(params[:action])
end