Updated how activerecord-import loads so it is done after a connection is established in ActiveRecord. This supports loading import for multiple adapters automatically w/o having to have a person require those specifically.

This commit is contained in:
Zach Dennis 2010-09-26 20:47:27 -04:00
parent 6c6a0d22b9
commit cb542a86f4
3 changed files with 27 additions and 8 deletions

View file

@ -28,10 +28,11 @@ FileUtils.mkdir_p 'log'
ActiveRecord::Base.logger = Logger.new("log/test.log")
ActiveRecord::Base.logger.level = Logger::DEBUG
ActiveRecord::Base.configurations["test"] = YAML.load(test_dir.join("database.yml").open)[adapter]
require "activerecord-import"
ActiveRecord::Base.establish_connection "test"
# load the library
require "activerecord-import"
ActiveSupport::Notifications.subscribe(/active_record.sql/) do |event, _, _, _, hsh|
ActiveRecord::Base.logger.info hsh[:sql]