我尝试将现有项目从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:inconnection' 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:inrescue in call' activerecord (4.1.4) lib/active_record/query_cache.rb:32:in
call' activerecord(4.1.4)lib / active_record / connection_adapters / abstract / connection_pool.rb:621:incall' 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)li
b / rack / runtime.rb:17:在`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
答案 0 :(得分:4)
事实证明,当从3.2迁移到4.0时,应用配置文件会有很多变化。您可以在下面的链接中看到详细信息,我能够使用postgres而不是sqlite解决问题,并运行链接建议的命令
rake rails:update