2012-03-21 40 views
1

我有一個適用於mongodb的Rails應用程序。我想將它部署到Heroku的,但得到的錯誤:ActiveRecord :: ConnectionNotEstablished(ActiveRecord :: ConnectionNotEstablished)

 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) 

嗯,我有評論sqlite的寶石在我的Gemfile:

# 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" 
+0

你有沒有刪除你的application.rb中ActiveRecord的都需要? – shingara 2012-03-21 09:01:24

+0

我已經更新了我的答案。它足以刪除活動記錄嗎? – demas 2012-03-21 09:05:01

+0

你需要active_record的地方嗎?您需要刪除這項要求 – shingara 2012-03-21 09:05:17

回答

7

在你的config/application.rb中需要發表意見要求的ActiveRecord的:

# require "active_record/railtie" 

如果您需要require 'rails/all'的所有導軌,您需要將它拆分爲您想要的所有railtie。通過例如在我的應用程序中使用Mongoid而不是ActiveRecord的,而不是ActionResources我只有在的地方「軌道/所有」的:

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

感謝它幫助我。我評論過要求「active_record/railtie」和環境/ *中的一些行。rb – demas 2012-03-21 09:09:34

+0

您需要評論rail/require的要求,因爲它不適用於您的答案。我用這些信息更新我的答案 – shingara 2012-03-21 09:11:52

相關問題