错误:
rake aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, but the
gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its
version is at the minimum required by ActiveRecord).
我的Gemfile包括:
group :production do
gem 'pg', '~> 0.18.4'
gem 'rails_12factor', '~> 0.0.3'
end
我已经使用"更新了捆绑包 - 没有生产"所有,但仍然得到同样的错误...
答案 0 :(得分:1)
在gemfile中添加pg
group :production do
gem 'pg', '~> 0.21'
gem 'rails_12factor'
end
#Terminal
>$ bundle install
>$ git add .
>$ git commit -m 'pg added'
>$ git push heroku master
确保Gemfile.lock已更新且已pg
。
答案 1 :(得分:0)
确保其版本达到ActiveRecord所需的最低要求
我刚刚使用pg版本0.20.0
group :production do
gem 'pg', '~> 0.20.0'
gem 'rails_12factor'
end
在Gemfile的组生产中进行此更新后,请确保运行bundle install --without production
(更新Gemfile.lock文件),执行git add / commit循环,然后重新部署到Heroku。
然后
heroku run rake db:migrate