0

I have installed all the gems that I saw listed in How to handle Ruby on Rails error: "Please install the postgresql adapter: `gem install activerecord-postgresql-adapter'" - none of them work. It doesn't matter if I have postgres or postgresql in my databases.yml file.

I have no clue what I am doing wrong (I also installed the driver mentioned in the error as well. I keep getting that error.

/var/lib/gems/1.8/gems/bundler-1.1.5/lib/bundler/rubygems_integration.rb:147:in `gem': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) 

I am trying to run "rails server webrick -p 80 -e production"

production:
  adapter: postgresql
  encoding: unicode
  database: imentor
  pool: 5
  username: postgres
  password: 
  host: localhost
  port: 5432

My problem was that I didn't actually know where to edit the gemfile ( (looked at the wrong gem file originally)

adding "gem 'pg'" to the Gemfile fixed it. Thanks to 'mu is too short'

3
  • I added what i have in /usr/bin/gem (not 100% sure if this is the right one - i also added 'pg' to it) Commented Sep 3, 2012 at 0:55
  • 2
    You should have a file called Gemfile in the root directory of your Rails app. Commented Sep 3, 2012 at 1:11
  • Awesome! my ignorance of gemfiles was to blame, it works now that I added "gem 'pg'" to it. Commented Sep 3, 2012 at 1:35

3 Answers 3

1

My problem was that I didn't actually know where to edit the gemfile (looked at the wrong gem file originally)

adding "gem 'pg'" to the Gemfile fixed it. Thanks to 'mu is too short'

Sign up to request clarification or add additional context in comments.

Comments

1

On ubuntu I just do

apt-get install libpgsql-ruby

Comments

0

I ran into a problem like this a few weeks back. I think you should try adding this code to the boot.rb file at first.

require 'yaml'
YAML::ENGINE.yamler = 'syck'

You should also try addding this to the grmfile and run a bundle install right after

gem 'pg'

If it helps also this is a sample of my database.yml file. Hope it works!

production:
  adapter: postgresql
  encoding: unicode
  database: dezirus
  username: postgres
  password: 

1 Comment

wouldn't it complain about not being able to parse or something related to yaml? This is also a brand new installation of everything, so there wouldn't be any problems with legacy code (which I think is where the yaml problems may come in)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.