Sha256: c16456d33619474d35b8ee2fc9c6045820d688b5dbc6397d5ee56ff3b9dc9660
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
puts "Loading DbCharmer..." module DbCharmer @@migration_connections_should_exist = Rails.env.production? mattr_accessor :migration_connections_should_exist def self.migration_connections_should_exist? !! migration_connections_should_exist end @@connections_should_exist = Rails.env.production? mattr_accessor :connections_should_exist def self.connections_should_exist? !! connections_should_exist end def self.logger return Rails.logger if defined?(Rails) @logger ||= Logger.new(STDERR) end end puts "Extending AR..." require 'db_charmer/active_record_extensions' require 'db_charmer/connection_factory' require 'db_charmer/connection_proxy' require 'db_charmer/connection_switch' require 'db_charmer/association_proxy' require 'db_charmer/multi_db_proxy' # Enable misc AR extensions ActiveRecord::Base.extend(DbCharmer::ActiveRecordExtensions::ClassMethods) # Enable connections switching in AR ActiveRecord::Base.extend(DbCharmer::ConnectionSwitch::ClassMethods) # Enable connection proxy in AR ActiveRecord::Base.extend(DbCharmer::MultiDbProxy::ClassMethods) ActiveRecord::Base.extend(DbCharmer::MultiDbProxy::MasterSlaveClassMethods) #ActiveRecord::Base.send(:include, DbCharmer::MultiDbProxy::InstanceMethods) # Enable connection proxy for associations ActiveRecord::Associations::AssociationProxy.send(:include, DbCharmer::AssociationProxy::InstanceMethods) puts "Doing the magic..." require 'db_charmer/db_magic' require 'db_charmer/finder_overrides' require 'db_charmer/multi_db_migrations' require 'db_charmer/multi_db_proxy' # Enable multi-db migrations ActiveRecord::Migration.extend(DbCharmer::MultiDbMigrations::ClassMethods) # Enable the magic ActiveRecord::Base.extend(DbCharmer::DbMagic::ClassMethods) #Extending ActionController puts "Extending ActionController..." require 'db_charmer/action_controller_extensions' ActionController::Base.send :include, DbCharmer::ActionControllerExtensions
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
glebpom-db-charmer-1.3.0 | lib/db_charmer.rb |