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}"
|
2011-12-28 13:07:08 -05:00
|
|
|
ActiveRecord::Model.logger = ActiveSupport::Logger.new("debug.log")
|
|
|
|
ActiveRecord::Model.configurations = connection_config
|
|
|
|
ActiveRecord::Model.establish_connection 'arunit'
|
2012-02-10 17:35:22 -05:00
|
|
|
ARUnit2Model.establish_connection 'arunit2'
|
2011-06-04 18:19:17 -04:00
|
|
|
end
|
|
|
|
end
|