Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile
simply adding gem 'pg' to the gemfile didn't work for me.
This worked for me
gem 'pg', '~> 0.20'
Got this answer from
Heroku and Rails: Gem Load Error with Postgres, however it is Specified in GEMFILE
Thanks to Piers C
And yeah, gem 'rails_12factor' helps when it's time view Heroku's logs for error messages.
Add this line to your Gemfile
inside the :production
group (add one if you don't have it).
group :production do
gem 'pg'
gem 'rails_12factor'
end
It's very clear from the error its self that gem pg
needs to be added to your Gemfile
. You might have added it simply but you need to add gem for your development and production machine specifically because the Heroku app is a production machine for your system and your localhost is Development.
Your Gemfile
should look like this:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'bootstrap-sass', '2.3.2.0'
gem 'bcrypt-ruby', '3.0.0'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor'
end