aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/support/connection.rb
blob: f4123c694d09864509358f2f66f4caa15f9b8f8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'logger'
require_dependency 'models/course'

module ARTest
  def self.connect
    connection_name = ENV['ARCONN'] || config['default_connection']
    puts "Using #{connection_name}"
    ActiveRecord::Base.logger = Logger.new("debug.log")
    ActiveRecord::Base.configurations = config['connections'][connection_name]
    ActiveRecord::Base.establish_connection 'arunit'
    Course.establish_connection 'arunit2'
  end
end