簡體   English   中英

ActiveRecord :: ConnectionNotEstablished(ActiveRecord :: ConnectionNotEstablished)

[英]ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)

我有一個可與mongodb一起使用的Rails應用程序。 我想將其部署到Heroku,但出現錯誤:

       Using sass-rails (3.2.5)
       Installing sqlite3 (1.3.5) with native extensions Unfortunately, a fatal error has occurred.
Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues
so that we can fix it. Thanks!
       /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions':
 ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

好吧,我在我的Gemfile中評論了sqlite-gem:

# gem 'sqlite3'

現在它可以在heroku上正確部署,但是在使用應用程序時出現錯誤:

[2012-03-21 12:53:46] INFO  WEBrick::HTTPServer#start: pid=9896 port=3000
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
MONGODB (140ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
MONGODB (131ms) some['$cmd'].find({:getnonce=>1}).limit(-1)
MONGODB (131ms) some['$cmd'].find({"authenticate"=>1, "user"=>"some", "nonce"=>"92a826e37bab5cd5", "key"=>"524d2de26fd6416b7cb0cddc2f496a2c"}).limit(-1)
MONGODB (131ms) some['$cmd'].find({:getnonce=>1}).limit(-1)
MONGODB (132ms) some['$cmd'].find({"authenticate"=>1, "user"=>"some", "nonce"=>"6a49c4f59de3294d", "key"=>"f081eb178e341e88d014c045b45ad633"}).limit(-1)


Started GET "/docs" for 127.0.0.1 at 2012-03-21 12:53:53 +0400

ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished):
  activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'

我該如何解決我的問題?

更新

我在application.rb中包含了下一行,因此它看起來像:

require 'rails/all'

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

在您的config / application.rb中,您需要注釋ActiveRecord的要求:

# require "active_record/railtie"

如果您需要按require 'rails/all'要求所有導軌,則require 'rails/all'require 'rails/all'所有railtie進行拆分。 例如,在我的應用程序中使用Mongoid而不是ActiveRecord而不是ActionResources的示例中,我只能代替'rails / all':

# require 'rails/all'
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM