我在 heroku 上部署我的应用程序时遇到问题。我已将“pg”gem 添加到 Gemfile,甚至尝试包含诸如 gem“therubyracer-heroku”之类的内容。 期间
heroku rake db:migrate
我得到这样的东西:
>heroku rake db:migrate
--trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:71:in `rescue in establish_conne
ction'
另一个有趣的部分是,在捆绑安装操作期间没有提到推送到 heroku pg,就像它被忽略一样。我还观看了 Gemfile.lock,其中提到了 pg:
pg (0.11.0-x86-mingw32)
我想知道是否是导致 heroku 忽略 pg gem 的 Windows gem 问题?
任何人都可以帮助或有类似的问题吗?
//编辑
似乎相关:enter link description here
看起来无法解决
最佳答案
在你的 Gemfile 中限制 postgres 到你的生产组;
group :production do
gem "pg"
end
再捆绑
bundle --without production
并提交到 git(Gemfile 和 Gemfile.lock)并推送到 Heroku。那应该可以解决您的问题。
关于ruby-on-rails - Rails 和 postgres - 在 heroku 上部署期间忽略 pg gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7822896/