Hartl's Chapter 7 when pushing to heroku, “pg is not part of the bundle” but it is

So I'm going through Hartl's Tutorial on RoR and I'm at the end of chapter 7. I'm trying to deploy to heroku. Everything up until the

heroku run rake db:migrate

step works, but that step gives me the error below. I ran bundle install several times and I'm not sure where my problem is. Also I can't access my heroku app online, even if I run heroku create --stack cedar and then git push heroku. It just gives me an application error when I go to my heroku app URL.

I am currently running Postgres.app and my rails server is not deployed.

Included is my Gemfile and database.yml. Feel free to look at the code at http://github.com/sambaek

Can someone help out? Thanks!

Terminal output
heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Connecting to database specified by DATABASE_URL
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)

Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
Gemfile
source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'

group :development, :test do
  gem 'rspec-rails', '2.11.0'
  gem 'guard-rspec', '0.5.5'
  gem 'pg'
  # gem 'sqlite3'
  gem 'guard-spork', '0.3.2'
  gem 'spork', '0.9.0'
  gem 'factory_girl_rails', '1.4.0'
end

gem 'annotate', '2.5.0', group: :development

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
  gem 'capybara', '1.1.2'
  gem 'rb-fsevent', '0.9.1', :require => false
  gem 'growl', '1.0.3'
end
config/database.yml
# postgresql
development:
  host: localhost
  adapter: postgresql
  encoding: utf8
  database: sample_app_development
  pool: 5
  username: 
  password: 

test:
  host: localhost
  adapter: postgresql
  encoding: utf8
  database: sample_app_test
  pool: 5
  username: 
  password: 

production:
  adapter: postgresql
  encoding: utf8
  database: sample_app_production
  pool: 5
  username:
  password:


# sqlite3
# development:
#   adapter: sqlite3
#   database: db/development.sqlite3
#   pool: 5
#   timeout: 5000

# # Warning: The database defined as "test" will be erased and
# # re-generated from your development database when you run "rake".
# # Do not set this db to the same as development or production.
# test:
#   adapter: sqlite3
#   database: db/test.sqlite3
#   pool: 5
#   timeout: 5000

# production:
#   adapter: sqlite3
#   database: db/production.sqlite3
#   pool: 5
#   timeout: 5000

Answers


Two problems:

  1. Your code on github shows that the pg gem is in the production group - just take it out of this group so that it will be included in all environments.
  2. The update to your question, which shows your Gemfile and config/database.yml, puts the pg gem inside test and development environments, where it won't be installed by Heroku

I see your answer below, but you don't need to put the pg gem in any group if you're using Postgres in all your environments, as it seems you are, based on your config/database.yml file.


Need Your Help

Client side pagination is not working using JSON in jqGrid

javascript jquery asp.net json jqgrid

I am new user for jQuery and jqGrid. I am trying to implement jqGrid with client side pagination. It is not working at my end. I am using .net 4.0 web service to get json response.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.