我在我的Mac上安裝了postgres,並且第一次嘗試了Rails。我包括寶石「pg」並刪除了sqlite3寶石(畢竟,如果使用前者,爲什麼還需要後者)。然而,當我試圖啓動服務器,我再次得到這個錯誤消息Rails:使用PG gem的Sqlite
.rvm/gems/[email protected]/gems/bundler-1.0.22/lib/bundler/rubygems_integration.rb:143:in `block in replace_gem': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError)
所以我包括sqlite3的寶石,現在服務器工作正常,但其實我沒有任何想法,如果我的測試應用程序是使用sqlite3或pg?
a)如果我打算使用pg gem,我應該安裝sqlite3 gem嗎? 二)如果我只應該有安裝的兩個中的一個,是有辦法找出哪一個我測試應用程序目前正在使用(因爲兩者都是在Gemfile中)
的Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'devise'
gem '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'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
我可以在這裏粘貼你的Gemfile嗎?你正在使用哪種Rails版本? – 2012-02-29 02:47:07
@Amit,rails 3.2.1,發佈gemfile在OP – Leahcim 2012-02-29 02:48:51
這聽起來像它試圖加載sqlite,是的Gemfile會有所幫助,也database.yml配置爲使用PG? – 2012-02-29 02:52:01