Sha256: e1db45b47bc6ad97d27066e2ed17533e674420b9bab77f8bb6093fb789830c69
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
module ConnectionManager module AbstractAdapter attr_reader :config # Determines if connection supports cross database queries def cross_schema_support? @cross_schema_support ||= (config[:adapter].match(/(mysql)|(postgres)|(sqlserver)/i)) end alias :cross_database_support? :cross_schema_support? def mysql? @is_mysql ||= (config[:adapter].match(/(mysql)/i)) end def postgresql? @is_postgresql ||= (config[:adapter].match(/(postgres)/i)) end def sqlserver? @is_sqlserver ||= (config[:adapter].match(/(sqlserver)/i)) end def replicated? (!slave_keys.blank? || !master_keys.blank?) end def database_name config[:database] end def slave_keys @slave_keys ||= (config[:slaves] ? config[:slaves].collect{|r| r.to_sym} : [] ) end def master_keys @master_keys ||= (config[:masters] ? config[:masters].collect{|r| r.to_sym} : []) end def replication_keys(type=:slaves) return slave_keys if type == :slaves master_keys end def replications {:slaves => slave_keys, :masters => master_keys} end end end ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include,(ConnectionManager::AbstractAdapter))
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
connection_manager-1.1.5 | lib/connection_manager/connection_adapters/abstract_adapter.rb |