ceth
ceth

Reputation: 45305

ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)

I have a Rails application that works with mongodb. I want to deploy it to Heroku, but get the error:

       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)

Well, I have commented the sqlite-gem in my Gemfile:

# gem 'sqlite3'

Now it deploy correctly on heroku, but i get error while I'am working with application:

[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'

How can I resolve my problem?

updated

I have included next line in my application.rb so it looks like:

require 'rails/all'

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

Upvotes: 1

Views: 4575

Answers (1)

shingara
shingara

Reputation: 46914

In your config/application.rb You need comment the require of ActiveRecord :

# require "active_record/railtie"

If you require all rails by require 'rails/all' you need split it by all railtie you want. By example in my application using Mongoid and not ActiveRecord and not ActionResources I have only in place of 'rails/all' :

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

Upvotes: 7

Related Questions