Sha256: ea7a27853ecd68124c2f703947031b30359a6cc468169e07ada6f7cb4b6696e0
Contents?: true
Size: 669 Bytes
Versions: 3
Compression:
Stored size: 669 Bytes
Contents
module ActiveRecord class Relation attr_accessor :slavery_target # Supports queries like User.on_slave.to_a alias_method :exec_queries_without_slavery, :exec_queries def exec_queries if slavery_target == :slave Slavery.on_slave { exec_queries_without_slavery } else exec_queries_without_slavery end end # Supports queries like User.on_slave.count alias_method :calculate_without_slavery, :calculate def calculate(*args) if slavery_target == :slave Slavery.on_slave { calculate_without_slavery(*args) } else calculate_without_slavery(*args) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
slavery-2.1.1 | lib/slavery/active_record/relation.rb |
slavery-2.1.0 | lib/slavery/active_record/relation.rb |
slavery-2.0.0 | lib/slavery/active_record/relation.rb |