gpt4 book ai didi

ruby-on-rails - Ubuntu 上 Rails 设置中的 ActiveRecord::ConnectionNotEstablished 错误

转载 作者:行者123 更新时间:2023-12-04 19:03:39 25 4
gpt4 key购买 nike

我正在尝试使用 Ruby on Rails 调试应用程序(3.0.8) 设置在 Ubuntu使用 RubyMine .我的应用程序没有数据库。

但是当我启动服务器时出现错误:-

ActiveRecord::ConnectionNotEstablished 

这是错误的完整跟踪:-
ctiverecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_specification.rb:170:in `retrieve_connection'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in `connection'
activerecord (3.2.8) lib/active_record/query_cache.rb:67:in `rescue in call'
activerecord (3.2.8) lib/active_record/query_cache.rb:61:in `call'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__515326265__call__889079158__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.1) lib/thin/connection.rb:79:in `catch'
thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.1) lib/thin/connection.rb:54:in `process'
thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:1484:in `event_callback'
eventmachine (1.0.3) lib/em/pure_ruby.rb:544:in `block in eventable_read'
eventmachine (1.0.3) lib/em/pure_ruby.rb:542:in `times'
eventmachine (1.0.3) lib/em/pure_ruby.rb:542:in `eventable_read'
/usr/lib/ruby/1.9.1/forwardable.rb:201:in `eventable_read'
eventmachine (1.0.3) lib/em/pure_ruby.rb:369:in `block in crank_selectables'
eventmachine (1.0.3) lib/em/pure_ruby.rb:369:in `each'
eventmachine (1.0.3) lib/em/pure_ruby.rb:369:in `crank_selectables'
eventmachine (1.0.3) lib/em/pure_ruby.rb:324:in `block in run'
eventmachine (1.0.3) lib/em/pure_ruby.rb:318:in `loop'
eventmachine (1.0.3) lib/em/pure_ruby.rb:318:in `run'
eventmachine (1.0.3) lib/em/pure_ruby.rb:62:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
thin (1.5.1) lib/thin/server.rb:159:in `start'
rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.5) lib/rack/server.rb:268:in `start'
railties (3.2.8) lib/rails/commands/server.rb:70:in `start'
railties (3.2.8) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.8) lib/rails/commands.rb:50:in `tap'
railties (3.2.8) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'

我还没有安装 MySql我的 Gemfile 中的 gem

当我在另一台机器(我的高级)上启动相同的应用程序时,它似乎可以工作。代码似乎是相同的。我尝试了各种站点的解决方案,但它似乎没有帮助..

有人可以帮我解决这个问题吗

最佳答案

我正在使用 rails 3.2.12评论 require 'rails/all'在/config/application.rb
并将这些添加到同一个文件中

require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"

也评论
#config.active_record.whitelist_attributes = true

现在在 config/environments/development.rb
评论这些行
#config.active_record.mass_assignment_sanitizer = :strict
#config.active_record.auto_explain_threshold_in_seconds = 0.5

检查我在 github 上的提交当我遇到同样的错误时。

关于ruby-on-rails - Ubuntu 上 Rails 设置中的 ActiveRecord::ConnectionNotEstablished 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19975027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com