Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Includes:
ExecQueriesWithStandbyTarget
Defined in:
lib/standby/active_record/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExecQueriesWithStandbyTarget

#exec_queries

Instance Attribute Details

#standby_targetObject

Returns the value of attribute standby_target.



14
15
16
# File 'lib/standby/active_record/relation.rb', line 14

def standby_target
  @standby_target
end

Instance Method Details

#calculate(*args) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/standby/active_record/relation.rb', line 19

def calculate(*args)
  if standby_target
    Standby.on_standby(standby_target) { calculate_without_standby(*args) }
  else
    calculate_without_standby(*args)
  end
end

#calculate_without_standbyObject

Supports queries like User.on_standby.count



17
# File 'lib/standby/active_record/relation.rb', line 17

alias_method :calculate_without_standby, :calculate