简体   繁体   中英

Ruby on Rails postgres adapter error when trying to run the server

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'

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'

在ubuntu上,我就是这么做的

apt-get install libpgsql-ruby

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: 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM