2012-02-12 74 views
0

我已经使用'install bundle'生成了一个应用程序,并且在欢迎登机应用程序的“关于您的应用程序的环境”页面中获取了错误ActiveRecord :: ConnectionNotEstablishedRoR - ActiveRecord :: ConnectionNotEstablished

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

什么想法?

  • 这是生成的Gemfile +更改轨道&的sqlite-红宝石的版本号通过排除法筛选,获得所述捆绑安装的一切。

一些背景

  1. 我要通过一本书,所以不同版本的建议都很好。
  2. 我不知道我在做什么。
  3. 我使用OSX 10.5(豹)

让我知道如果有什么我应该补充更多的信息。奖金问题:如果我需要从头开始使用不同的sqlite版本,我应该创建一个新的应用程序还是可以再次使用Bundler?

编辑 克莱伯S.曾建议配置配置您的config/database.yml文件的文件看起来像:

# 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 

任何想法有什么不对?

+1

如果你改变你的Gemfile,首先尝试运行'bundle install',如果一个特定的gem版本被锁定,它会要求你运行'bundle update * somegem *' – 2012-02-12 17:20:11

+0

谢谢。 要清楚,运行软件包更新不仅仅是添加宝石? – ntc 2012-02-12 17:31:38

+0

'捆绑更新'本身去寻找所有宝石的最新版本。 – 2012-02-14 16:24:14

回答

1

您可能要正确配置您的config/database.yml文件。

可能需要在SQLite上创建一个新的数据库来修复该错误。

奖励答案:您不必从头开始,只需配置database.yml文件即可。

+0

这里是config/database.yml文件 https://docs.google.com/document/d/1LU8RcI--uw-O8pQcujEKSQFhd7RZPU0Iu6JOCQn5yjE/edit – ntc 2012-02-12 17:36:49

0

又是怎么回事只是将下面一行:

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

通过这条线:

gem 'sqlite3' 

在你的Gemfile?

编辑:好吧,忘记这一点,MAC OS 10.5不能使用sqlite3。所以gemfile似乎是正确的。

+0

试过了。出现错误: 安装sqlite3(1.3.5)时发生错误,并且Bundler无法继续。 确保'gem install sqlite3 -v'1.3.5''捆绑成功。 – ntc 2012-02-12 17:33:51

相关问题