Rails 4 postgres bug - cannot create database because the pg gem “is missing”, but it is not

痴心易碎 提交于 2019-12-25 01:35:49

问题


I use rails edge (4.0) and when executing:

bundle exec rake db:create

I get

Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile.

I do have "gem pg" in my Gemfile and I have run bundle install...

what could be the reason for this?

thank you


回答1:


The problem was that I was using an old version of pg gem (0.9.0), newer versions work as expected!




回答2:


For me, works without user/pass, and using host settings on config/database.yml

defatul: &default
  adapter: postgresql
  encoding: utf-8
  host: localhost
  pool: 5

development:
  <<: *default
  database: appname_development

test:
  <<: *default
  database: appname_test


来源:https://stackoverflow.com/questions/15958219/rails-4-postgres-bug-cannot-create-database-because-the-pg-gem-is-missing-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!