我试图将现有项目从Rails 3.2.3升级到Rails 4.1.4(最新版本)。我更新了我的gemfile,并且没有任何问题。我还加了
config.eager_load = false
到我的环境* .rb。当我运行服务器时,尝试访问第一页时出现以下错误……看起来好像没有数据库连接,但是我可以使用客户端来访问它。我的服务当前使用sqlite3 ..
ActiveRecord :: ConnectionNotEstablished
(ActiveRecord :: ConnectionNotEstablished):
activerecord(4.1.4)lib / active_record / connection_adapters / abstract / connection_pool.rb:541:in
retrieve_connection'
activerecord (4.1.4) lib/active_record/connection_handling.rb:113:in
retrieve_connection'activerecord(4.1.4)lib / active_record / connection_handling.rb:87:在
connection'
activerecord (4.1.4) lib/active_record/query_cache.rb:51:in
restore_query_cache_settings'中activerecord(4.1.4)lib / active_record / query_cache.rb:43:在
rescue in call'
activerecord (4.1.4) lib/active_record/query_cache.rb:32:in
调用中activerecord(4.1.4)lib / active_record / connection_adapters / abstract / connection_pool.rb:621:in
call'
actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:29:in
阻止通话”activesupport(4.1.4)lib / active_support / callbacks.rb:82:在`run_callbacks'(1.5.2)中
b / rack / runtime.rb:17:in'call'
…
我的database.yml文件没有更改。它使用sqlite3
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem '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
最佳答案
事实证明,从3.2迁移到4.0时,有很多更改要应用于配置文件。您可以在下面的链接中查看详细信息,我能够使用postgres代替sqlite并运行该链接建议的命令来解决问题
rake rails:update
Upgrading to rails 4.0 from 3.2
关于ruby-on-rails - 升级到ActiveRecord::ConnectionNotEstablished错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24858300/