Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
charger opened this Issue · 4 comments

4 participants

@charger

my gemfile:

gem 'pg', '>=0.14.0'
gem 'em-postgresql-adapter', :git => 'git://github.com/leftbee/em-postgresql-adapter.git'
gem 'em-synchrony', :git     => 'git://github.com/igrigorik/em-synchrony.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.yml:

  database: sqoffers_development
  adapter: em_postgresql
  pool: 20
  connections: 20
  encoding: unicode
  port: 5432
  host: 127.0.0.1
  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

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?

@lucaspiller

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
Owner

@lucaspiller, what do you have in mind?

@cmthakur

@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")
    end
  end
@zdennis zdennis closed this in #120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.