0

我最近在更换机器后在 GitHub 上克隆了我的项目,我运行了 bundle install 并启动了本地服务器,得到了这个消息:

ActiveRecord::ConnectionNotEstablished

谷歌搜索后,我手动创建了一个 database.yml 文件并输入了以下信息:

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
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

并运行 rake db:create 和 rake db:migrate 但我仍然收到错误,任何人都可以提出任何建议吗?

顺便说一句,这是我的 Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.14'
gem 'jquery-rails', '2.0.2'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'

group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
  gem 'guard-rspec', '1.2.1'
  gem 'guard-spork', '1.2.0'
  gem 'childprocess', '0.3.6'
  gem 'spork', '0.9.2'
end

group :test do
  gem 'capybara', '1.1.2'
  gem 'rb-fchange', '0.0.5'
  gem 'rb-notifu', '0.0.4'
  gem 'win32console', '1.3.0'
  gem 'factory_girl_rails', '4.1.0'
  gem 'cucumber-rails', '1.2.1', :require => false
  gem 'database_cleaner', '0.7.0'
end

group :development do
  gem 'annotate', '2.5.0'
end

group :production do
  gem 'pg', '0.12.2'
end

group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end
4

1 回答 1

1

运行数据库迁移:

# from command line
rake db:migrate

然后,如果有一个db/seeds.db文件,您可以使用它来为您的数据库播种:

rake db:seed
于 2013-09-04T20:34:18.627 回答