ROR - ActiveRecord:: connectionnotestestablished:没有PublicAct



我正在尝试从ruby 2.3.1到2.3.8的小升级,并面临一些问题。一切工作正常,直到我运行命令rake db:create并发现以下错误-

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)>'

我也跟踪了错误,发现以下信息-

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>'

我无法找到错误的根本原因。请帮助!

编辑-

我已经尝试在不同的系统上安装相同版本的ruby应用程序,它仍然显示相同的错误。新系统的配置有什么问题吗?

这是数据库。Yml文件-

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

添加作为答案,以包含代码块:

我的形式:

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

适配器假定本地主机和端口,并假定基于当前用户名的用户名(我不需要密码访问它)。

我不知道pooltimeout值是必要的,但这个配置对我有效。

相关内容

  • 没有找到相关文章

最新更新