views:

541

answers:

2

I'm trying to get Redmine working with postgres.

In my logs I keep seeing.

Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`

After googling everyone said you needed to do gem install pg. But when I do gem list

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.8, 2.3.5)
activeresource (2.3.5)
activesupport (2.3.8, 2.3.5)
fastthread (1.0.7)
passenger (2.2.15)
pg (0.9.0)
postgres (0.7.9.2008.01.28)
postgres-pr (0.6.3)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)

You can clearly see that pg is already installed. Has anyone else found this issue or fixed it?

A: 

I never worked with postgre sql gem, but I've solved similar error before by adding this into config/preinitializer.rb.

require 'rubygems'
require 'rubygems/gem_runner'

ENV['GEM_PATH'] = '/home/[username]/ruby/gems:/usr/lib/ruby/gems/1.8'
Gem.clear_paths

Note: you'll have to use your own gem locations. Usually you can find them by running gem environment.

You may also find some answers here useful:
http://stackoverflow.com/questions/1664364/how-to-handle-ruby-on-rails-error-please-install-the-postgresql-adapter-gem-i

Nikita Rybak
Now I get /opt/redmine/apps/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (/usr/lib/ruby/gems/1.8/gems/pg-0.9.0/lib/pg_ext.so: wrong ELF class: ELFCLASS64 - /usr/lib/ruby/gems/1.8/gems/pg-0.9.0/lib/pg_ext.so) (RuntimeError)
silent1mezzo
It's not related to ruby anymore, something's wrong with your native postgre library. In particular, have you downloaded correct version (32/64 bit)? Also, there seems to be a lot of related content in google for "wrong ELF class: ELFCLASS64"
Nikita Rybak
Postgres or PostgreSQL - not postgre
rfusca
+2  A: 

make sure your db-adapter in database.yml is set to "postgresql". If still you have the same problem, then try using the pure-ruby adapter:

gem install postgres-pr

(make sure you uninstall the pg gem before... to avoid conflicts)

If it works, then it's a problem with the postgres gem. Anyway, for development purposes, using the pure-ruby gem is usually ok.

rolando