Sha256: f42922535baa3cd0316884c3f523412d0fd6d7bb6de7d3d77a980c56ea5a91b2
Contents?: true
Size: 665 Bytes
Versions: 1
Compression:
Stored size: 665 Bytes
Contents
module ExecQueriesWithStandbyTarget # Supports queries like User.on_standby.to_a def exec_queries if standby_target Standby.on_standby(standby_target) { super } else super end end end module ActiveRecord class Relation attr_accessor :standby_target # Supports queries like User.on_standby.count alias_method :calculate_without_standby, :calculate def calculate(*args) if standby_target Standby.on_standby(standby_target) { calculate_without_standby(*args) } else calculate_without_standby(*args) end end end end ActiveRecord::Relation.prepend(ExecQueriesWithStandbyTarget)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
standby-5.0.0 | lib/standby/active_record/relation.rb |