Class: ActiveRecord::Relation
- Inherits:
-
Object
- Object
- ActiveRecord::Relation
- Includes:
- ExecQueriesWithStandbyTarget
- Defined in:
- lib/standby/active_record/relation.rb
Instance Attribute Summary collapse
-
#standby_target ⇒ Object
Returns the value of attribute standby_target.
Instance Method Summary collapse
- #calculate(*args) ⇒ Object
-
#calculate_without_standby ⇒ Object
Supports queries like User.on_standby.count.
Methods included from ExecQueriesWithStandbyTarget
Instance Attribute Details
#standby_target ⇒ Object
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_standby ⇒ Object
Supports queries like User.on_standby.count
17 |
# File 'lib/standby/active_record/relation.rb', line 17 alias_method :calculate_without_standby, :calculate |