Error "cannot load em_postgresql_adapter" when using gem em-postgresql-adapter #89

charger opened this Issue Mar 15, 2013 · 4 comments


None yet
4 participants

charger commented Mar 15, 2013

my gemfile:

gem 'pg', '>=0.14.0'
gem 'em-postgresql-adapter', :git => 'git://'
gem 'em-synchrony', :git     => 'git://',
    :require => ['em-synchrony','em-synchrony/activerecord', 'em-synchrony/em-http']
gem 'rack-fiber_pool',  :require => 'rack/fiber_pool'
gem 'activerecord-import', '>= 0.3.0'


  database: sqoffers_development
  adapter: em_postgresql
  pool: 20
  connections: 20
  encoding: unicode
  port: 5432
  username: user
  password: 123

Error when start application:

Uncaught exception: cannot load such file -- /home/charger/.rvm/gems/ruby-1.9.3-p374@global/gems/activerecord-import-0.3.0/lib/activerecord-import/active_record/adapters/em_postgresql_adapter
    /home/charger/.rvm/gems/ruby-1.9.3-p374@global/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    /home/charger/.rvm/gems/ruby-1.9.3-p374@global/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    /home/charger/.rvm/gems/ruby-1.9.3-p374@global/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    /home/charger/.rvm/gems/ruby-1.9.3-p374@global/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'

how fix this?

charger commented Mar 15, 2013

If I create empty file: /home/charger/.rvm/gems/ruby-1.9.3-p374@global/gems/activerecord-import-0.3.0/lib/activerecord-import/active_record/adapters/abstract_adapter.rb
application started and work fine. Maybe this is solution?

I've come across this as I'm trying to use nulldb to speed up testing, I get the same error for this adapter.

Is the require_adapter stuff in lib/activerecord-import/base.rb really necessary?


zdennis commented May 6, 2013

@lucaspiller, what do you have in mind?

@zdennis can we check whether the file exist before requiring it. If we do that what are the consequences.

  def self.require_adapter(adapter)
     if File.exist?(File.join(AdapterPath,"/#{base_adapter(adapter)}_adapter"))
       require File.join(AdapterPath,"/abstract_adapter")
       require File.join(AdapterPath,"/#{base_adapter(adapter)}_adapter")

@zdennis zdennis closed this in #120 Dec 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment