avallach
avallach

Reputation: 63

Rails and postgres - pg gem ignored during deploy on heroku

I have trouble deploying my app on heroku. I have added 'pg' gem to Gemfile, and even try to include something like gem 'therubyracer-heroku'. during

heroku rake db:migrate

I get something like this:

>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'

Another interesting part is that while pushing to heroku pg is not mentioned during bundle install operation like if it was ignored. I also watched the Gemfile.lock and pg is mentioned there to:

pg (0.11.0-x86-mingw32)

I wonder if it is a Windows gem issue that cause heroku to ignore the pg gem or something ?

Can anyone help or had similar problem ?

//EDIT

Seems related: enter link description here

And looks unsolveable

Upvotes: 1

Views: 1355

Answers (1)

John Beynon
John Beynon

Reputation: 37507

In your Gemfile limit postgres to your production group;

group :production do
  gem "pg"
end

rebundle

bundle --without production

and commit to git (Gemfile and Gemfile.lock) and push to Heroku. That should solve your problem.

Upvotes: 2

Related Questions