2011-12-21 12:10:20 -05:00
|
|
|
require 'active_support/logger'
|
2012-08-10 12:42:48 -04:00
|
|
|
require 'models/college'
|
|
|
|
require 'models/course'
|
2011-06-04 18:19:17 -04:00
|
|
|
|
|
|
|
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
|
2012-03-01 22:10:06 -05:00
|
|
|
puts "Using #{connection_name}"
|
2012-10-26 10:51:02 -04:00
|
|
|
ActiveRecord::Base.logger = ActiveSupport::Logger.new("debug.log", 0, 100 * 1024 * 1024)
|
|
|
|
ActiveRecord::Base.configurations = connection_config
|
2013-12-24 04:18:54 -05:00
|
|
|
ActiveRecord::Base.establish_connection :arunit
|
|
|
|
ARUnit2Model.establish_connection :arunit2
|
2011-06-04 18:19:17 -04:00
|
|
|
end
|
|
|
|
end
|