platanus / potassium

A Rails application generator by Platanus, inspired by Suspenders
MIT License
232 stars 17 forks source link

Not recognizing gem 'pg' in Gemfile when version is 1.0.0 or not specified #156

Closed aamatte closed 6 years ago

aamatte commented 6 years ago

When using postgresql as database, the gem pg is added to the Gemfile. After running bundle install and rails s the following error occurs:

/home/andres/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'postgre
sql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)

If I specify the version 1.0.0 the error still ocurrs. If I specify the gem version as 0.20, the error disapears. The manual fix is easy, but I think the generator should include the 0.20 version in the Gemfile. The error may be caussed by the 1.0.0 version of pg (found this issue). I'm using Rails 5.1.4, ruby 2.3.1 and Postgres 9.4.8 in Ubuntu 16.04.

rjherrera commented 6 years ago

The problem appears to be fixed in rails 5.1.5.rc1, but I think that it is a better practice to specify explicitly a version for each gem, as some updates may break the setup (as it happened with the pg gem).