0
votes

I have generated an app using 'install bundle' and am getting the error ActiveRecord::ConnectionNotEstablished in the "About your application’s environment" page of the welcome aboard app.

The Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.0'

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

gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'

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

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

any ideas?

  • This is the generated gemfile + changes to the version numbers of rails & sqlite-ruby selected by process of elimination to get the bundler to install everything.

Some Background

  1. I am going through a book so suggestions about different versions are fine.
  2. I don't know what I'm doing.
  3. I'm using OSX 10.5 (leopard)

Let me know if there is any more information I should add.

Bonus question: If I need to start from scratch with a different sqlite version, should I create a new app or can I user the Bundler again?

edit Kleber S. has suggested configuring the configure your config/database.yml file the file looks like:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

any ideas what's wrong?

2
if you change your Gemfile, firstly try just running bundle install, if a specific gem version is locked, it'll ask you to run bundle update *somegem* - Matthew Rudy
thanks. To be clear, running bundle update doesn't just keep adding gems? - ntc
bundle update by itself goes to find the lastest versions of all gems. - Matthew Rudy

2 Answers

1
votes

you have probably to proper configure your config/database.yml file.

It may be necessary to create a new database on SQLite to fix that error.

bonus answer: you don't have to start it from scratch, just configure the database.yml file.

0
votes

And what about just replacing this line :

gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'

By this line :

gem 'sqlite3'

In your gemfile?

EDIT : ok, forget about this, MAC OS 10.5 can't use sqlite3. So the gemfile seems to be correct.