Sha256: ed3d8ded4a2a43a6de4367f968cbcc0bce0fe507d7f5470cd963b066d67f0f15
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
module ActiveRecord class Relation private def exec_queries_with_slave_connection return @records if loaded? if FreshConnection::SlaveConnection.ignore_model?(@klass.name) FreshConnection::SlaveConnection.force_master_access { exec_queries_without_slave_connection } elsif go_slave? FreshConnection::SlaveConnection.slave_access { exec_queries_without_slave_connection } else FreshConnection::SlaveConnection.master_access { exec_queries_without_slave_connection } end end alias_method_chain :exec_queries, :slave_connection def go_slave? connection.open_transactions == 0 && (@readonly_value.nil? || @readonly_value) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fresh_connection-0.1.0 | lib/fresh_connection/active_record/relation.rb |