I am trying to do minor upgrade from ruby 2.3.1 to 2.3.8 and facing some issues. Everything was working fine until I run the command rake db:create and find the following error -

rake aborted!
ActiveRecord::ConnectionNotEstablished: No connection pool for PublicActivity::ORM::ActiveRecord::Activity
/home/user/application/engines/admin/lib/admin/activity_extension.rb:10:in `<module:Admin>'
/home/user/application/engines/admin/lib/admin/activity_extension.rb:1:in `<top (required)>'
/home/user/application/engines/admin/lib/admin/engine.rb:8:in `<top (required)>'
/home/user/application/engines/admin/lib/admin.rb:1:in `require'
/home/user/application/engines/admin/lib/admin.rb:1:in `<top (required)>'
/home/user/application/config/application.rb:17:in `<top (required)>'
/home/user/application/Rakefile:4:in `<top (required)>'

I have also traced the error and find the following information -

rake aborted!
ActiveRecord::ConnectionNotEstablished: No connection pool for PublicActivity::ORM::ActiveRecord::Activity
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:570:in `retrieve_connection'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activerecord-4.2.11.3/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activerecord-4.2.11.3/lib/active_record/connection_handling.rb:87:in `connection'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activerecord-4.2.11.3/lib/active_record/model_schema.rb:230:in `table_exists?'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/orm/active_record/activity.rb:47:in `<class:Activity>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/orm/active_record/activity.rb:22:in `<module:ActiveRecord>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/orm/active_record/activity.rb:19:in `<module:ORM>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/orm/active_record/activity.rb:18:in `<module:PublicActivity>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/orm/active_record/activity.rb:3:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/orm/active_record.rb:4:in `require_relative'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/orm/active_record.rb:4:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity.rb:53:in `inherit_orm'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/models/activity.rb:4:in `<module:PublicActivity>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/public_activity-1.6.4/lib/public_activity/models/activity.rb:3:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `require'
/home/user/application/engines/admin/lib/admin/activity_extension.rb:10:in `<module:Admin>'
/home/user/application/engines/admin/lib/admin/activity_extension.rb:1:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in `require'
/home/user/application/engines/admin/lib/admin/engine.rb:8:in `<top (required)>'
/home/user/application/engines/admin/lib/admin.rb:1:in `require'
/home/user/application/engines/admin/lib/admin.rb:1:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
/home/user/application/config/application.rb:17:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/user/.rbenv/versions/2.3.8/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/user/application/Rakefile:4:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in `load'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in `load_rakefile'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:703:in `raw_load_rakefile'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:104:in `block in load_rakefile'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:103:in `load_rakefile'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:82:in `block in run'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:80:in `run'
/home/user/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/home/user/.rbenv/versions/2.3.8/bin/rake:22:in `load'
/home/user/.rbenv/versions/2.3.8/bin/rake:22:in `<main>'

I am unable to find the root cause of error. Please help!

EDIT -

I have tried to install the application with same version of ruby on different system and it still shows the same error. Is there any issue with the new system's configuration?

This is the database.yml file -

default: &default
  adapter: postgresql
  encoding: unicode
  username: -----
  password: -----
  host: localhost
  port: 5432
  pool: 5

development:
  <<: *default
  database: -----
1

There are 1 answers

1
Jad On

adding as an answer, to include code blocks:

my database.yml:

default: &default
  adapter: postgresql
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: project-dev

# 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:
  <<: *default
  database: project-test

production:
  <<: *default
  database: project

the adapter assumes localhost and port, and assumes username based on the current username (I access it without a password).

I don't know if the pool or timeout values are essential, but this configuration works for me.