2011-12-21 12:10:20 -05:00
|
|
|
require 'active_support/logger'
|
2011-06-04 18:19:17 -04:00
|
|
|
require_dependency 'models/course'
|
|
|
|
|
|
|
|
module ARTest
|
2011-06-05 06:28:02 -04:00
|
|
|
def self.connection_name
|
|
|
|
ENV['ARCONN'] || config['default_connection']
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.connection_config
|
|
|
|
config['connections'][connection_name]
|
|
|
|
end
|
|
|
|
|
2011-06-04 18:19:17 -04:00
|
|
|
def self.connect
|
2011-06-09 15:15:34 -04:00
|
|
|
puts "Using #{connection_name} with Identity Map #{ActiveRecord::IdentityMap.enabled? ? 'on' : 'off'}"
|
2011-12-21 12:10:20 -05:00
|
|
|
ActiveRecord::Base.logger = ActiveSupport::Logger.new("debug.log")
|
2011-06-05 06:28:02 -04:00
|
|
|
ActiveRecord::Base.configurations = connection_config
|
2011-06-04 18:19:17 -04:00
|
|
|
ActiveRecord::Base.establish_connection 'arunit'
|
|
|
|
Course.establish_connection 'arunit2'
|
|
|
|
end
|
|
|
|
end
|