Skip to content

Instantly share code, notes, and snippets.

@jonathan
Created March 12, 2010 15:35
Show Gist options
  • Save jonathan/330433 to your computer and use it in GitHub Desktop.
Save jonathan/330433 to your computer and use it in GitHub Desktop.
superclass mismatch for class PostgreSQLAdapter (TypeError)
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:189
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/dependencies.rb:209:in `require'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/dependencies.rb:209:in `require'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/dependencies.rb:197:in `load_dependency'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/dependencies.rb:209:in `require'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:74:in `establish_connection'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/railtie.rb:50
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/lazy_load_hooks.rb:21:in `instance_eval'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/lazy_load_hooks.rb:21:in `run_base_hooks'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/lazy_load_hooks.rb:21:in `each'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/lazy_load_hooks.rb:21:in `run_base_hooks'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/base.rb:2248
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/fixtures.rb:911:in `setup_fixtures'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/callbacks.rb:408:in `_run_setup_callbacks'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/callbacks.rb:88:in `send'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/callbacks.rb:88:in `Before'
When I am on the scope inputs index page # features/step_definitions/web_steps.rb:18
Then I should see "scope_inputs" # features/step_definitions/web_steps.rb:99
ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:330:in `retrieve_connection'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:103:in `retrieve_connection'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:95:in `connection'
.bundle/ruby/1.8/bundler/gems/rails-master/activerecord/lib/active_record/fixtures.rb:950:in `teardown_fixtures'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/callbacks.rb:408:in `_run_teardown_callbacks'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/callbacks.rb:88:in `send'
.bundle/ruby/1.8/bundler/gems/rails-master/activesupport/lib/active_support/callbacks.rb:88:in `After'
@bobbywilson0
Copy link

Did you ever get this figured out? I am running into the same issue using bundler.

thanks
Bobby

@jonathan
Copy link
Author

jonathan commented Apr 2, 2010

Not yet. I've been pulled to another project using rails 2.3.5 so I haven't been able to play with rails 3.

@bobbywilson0
Copy link

My problem was actually somewhat different, but essentially the same error. I was using a gem that was reopening PostgreSQLAdapter without subclassing AbstractAdapter, causing the error. It didn't exist for me before using bundler because the load order was different, so I don't know if this will help you any. Anyway I thought I would share my solution.

@jonathan
Copy link
Author

jonathan commented Apr 2, 2010

It seems to be the same problem. Rails 3 autoloads most things now and database_cleaner opens up the adapters to add a truncate method. I think to fix the problem database_cleaner just needs to require the proper classes first before opening the class. Unfortunately, I haven't had the time to look into it.

@krisleech
Copy link

I tried the below but it didn't work:

gem 'database_cleaner', :require => false

In spec_helper.rb:

require 'database_cleaner'

I'm not using pg, only mysql.

@krisleech
Copy link

In the end I reverted to 0.5.0, which works for me.

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