views:

1223

answers:

3

I'm trying to deploy a rails app to heroku, but keep getting the following error. I'd have thought that managing the postgres gems would be something heroku would handle.

I've tried everything I can think of short of installing postgres on my local machine, which I'd need to do if I wanted to install the postgres gem. There's also no gem called activerecord-postgresql-adapter... I'm guessing this is the standard adapter that comes with rails??

Any thoughts on how to fix this?

App failed to start

/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (no such file to load -- pg) (RuntimeError)
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:438:in `initialize_database'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:141:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /disk1/home/slugs/135415_c7f31f0_9f1f/mnt/config/environment.rb:9
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 ... 14 levels...
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
from /home/heroku_rack/heroku.ru:1:in `new'
from /home/heroku_rack/heroku.ru:1
+1  A: 

It turns out this is a bug because of different versions of bundler running on heroku and my machine. I've switched to using the .gems dependency file and everything seems to be working.

jonnii
+3  A: 

Upgrade your Gemfile to Bundler 0.9 and add the pg gem. Easy as that.

Sam Soffes
A: 

Details on Heroku's bundler support are here: http://docs.heroku.com/bundler

Heroku requires you specify the 'pg' gem.

Jay Carroll