Forum: Ruby on Rails Rails 3.1.0 cannot connect to sqlite database on Mac Lion

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
72d362060aed96f3de7e1d4ca54f3dcc?d=identicon&s=25 Scott Eisenberg (Guest)
on 2012-05-16 04:43
(Received via mailing list)
I'm running Rails 3.2.3 on Mac Lion with sqlite 3.7.7 and ruby
1.9.3p125.  I need to back down rails to 3.1.0 for a project but when I
do that a simple index page give me a


Rails 3.2.3 works, 3.1.0 not.  Any ideas?

Just to show you it's nothing fancy....

Gem file is only:

source ''

gem 'rails', '3.1.0'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://'

gem 'sqlite3'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'

  # See for more supported
  # gem 'therubyracer', :platform => :ruby

  gem 'uglifier', '>= 1.0.3'

gem 'jquery-rails'

  root :to => "home#index"

home controller:
class HomeController < ApplicationController
  def index

955103d80e386882143a78875fb727bf?d=identicon&s=25 Jeremy W. (jeremy_w)
on 2012-05-16 14:25
(Received via mailing list)
On 16 May 2012 03:42, Scott Eisenberg <> wrote:

> I'm running Rails 3.2.3 on Mac Lion with sqlite 3.7.7 and ruby 1.9.3p125.
>  I need to back down rails to 3.1.0 for a project but when I do that a
> simple index page give me a  ActiveRecord::ConnectionNotEstablished
> error.

What does
bundle exec db:migrate
give you?
600a23817dcc8aea105897c93712b85b?d=identicon&s=25 Rodrigo Vieira (Guest)
on 2012-05-16 16:11
(Received via mailing list)
Make sure your config/database.yml referes to proper database
i.e username, password, socket.

On Wed, May 16, 2012 at 9:22 AM, Jeremy Walker <>

> What does
>> gem 'sqlite3'
>>   # gem 'therubyracer', :platform => :ruby
>> class HomeController < ApplicationController
>> To unsubscribe from this group, send email to
> For more options, visit this group at

Rodrigo Alves Vieira
Software Developer, Bemind
72d362060aed96f3de7e1d4ca54f3dcc?d=identicon&s=25 Scott Eisenberg (Guest)
on 2012-05-16 18:53
(Received via mailing list)
They seem to be ok. When I take off the 3.1.0 from the rails gem in the
Gemfile, it connects just fine with no other changes.
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2012-05-16 19:50
(Received via mailing list)
On Tue, May 15, 2012 at 7:42 PM, Scott Eisenberg <>
> I'm running Rails 3.2.3 on Mac Lion with sqlite 3.7.7 and ruby 1.9.3p125. I
> need to back down rails to 3.1.0 for a project

What does "back down" mean? Are you running bundle install after
changing your Gemfile? (Personally I would blow away Gemfile.lock

Regardless, are you using rvm? If not, you should be if you're doing
work on projects using different versions of Rails.

What's the complete error trace?

Hassan Schroeder ------------------------
twitter: @hassan
72d362060aed96f3de7e1d4ca54f3dcc?d=identicon&s=25 Scott Eisenberg (Guest)
on 2012-05-17 03:41
(Received via mailing list)
Back down just means changing the Gemfile line from

  gem 'rails', '3.2.3'    change to ---->>     gem 'rails', '3.1.0'

then bundle update.  Nothing else.

Tried deleting Gemfile.lock.  That did not help.

The reason I am doing this is I have to use a gem that won't work with
3.2.3, requires 3.1.0

I don't mess with rvm at all.  It stays at:

new-host-7:jbe_debug scott$ rvm list

rvm rubies

   ruby-1.9.2-p290 [ x86_64 ]
=* ruby-1.9.3-p125 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

The stacktrace is:

activerecord (3.1.0)
activerecord (3.1.0)
activerecord (3.1.0)
activerecord (3.1.0) lib/active_record/query_cache.rb:65:in `rescue in
activerecord (3.1.0) lib/active_record/query_cache.rb:59:in `call'
activerecord (3.1.0)
actionpack (3.1.0) lib/action_dispatch/middleware/callbacks.rb:29:in
`block in call'
activesupport (3.1.0) lib/active_support/callbacks.rb:392:in
activesupport (3.1.0) lib/active_support/callbacks.rb:81:in
actionpack (3.1.0) lib/action_dispatch/middleware/callbacks.rb:28:in
actionpack (3.1.0) lib/action_dispatch/middleware/reloader.rb:68:in
rack (1.3.6) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/remote_ip.rb:48:in
actionpack (3.1.0)
lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.0) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.6) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.6) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.0)
lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.6) lib/rack/lock.rb:15:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.0) lib/rails/engine.rb:455:in `call'
railties (3.1.0) lib/rails/rack/content_length.rb:16:in `call'
railties (3.1.0) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.6) lib/rack/handler/webrick.rb:59:in `service'
`block in start_thread'

The bundle update does:

Fetching gem metadata from
Using rake (
Using multi_json (1.3.5)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using erubis (2.7.0)
Using rack (1.3.6)
Using rack-cache (1.0.3)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.4)
Using actionpack (3.1.0)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.3.3)
Using actionmailer (3.1.0)
Using arel (2.2.3)
Using tzinfo (0.3.33)
Using activerecord (3.1.0)
Using activeresource (3.1.0)
Using bundler (1.1.3)
Using coffee-script-source (1.3.3)
Using execjs (1.3.2)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.1.0)
Using coffee-rails (3.1.1)
Using jquery-rails (1.0.19)
Using rails (3.1.0)
Using sass (3.1.18)
Using sass-rails (3.1.6)
Using sqlite3 (1.3.6)
Using uglifier (1.2.4)
Your bundle is updated! Use `bundle show [gemname]` to see where a
bundled gem is installed.
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2012-05-17 05:49
(Received via mailing list)
On Wed, May 16, 2012 at 6:40 PM, Scott Eisenberg <>

> I don't mess with rvm at all. It stays at:

Then what's the point? Use it as intended: create a new gemset just
for this 3.1 app and do a clean bundle install. Then copy in your app
and see what happens.

I just did exactly that (except I created a new test app) and it worked
out of the box (Ruby 1.9.3-p125, Rails 3.1, SQLite3, Lion).

Hassan Schroeder ------------------------
twitter: @hassan
534e2dda3d203916cded6d257111d217?d=identicon&s=25 "Rafael Fernández López" <> (Guest)
on 2012-05-17 13:12
(Received via mailing list)
Somewhere on your code you are forcing a establish_connection, that's
problem. At least the backtrace is exactly the same I was getting with
problem. When I investigated this issue I found out that the sqlite3
backend hasnt got implemented the close() method, so your
establish_connection will fail, because the database will be kept open.

Try to remove any establish_connection added manually, and try if it

I stumbled across this problem before, and I even started a thread on
rails-core about this issue.
This topic is locked and can not be replied to.