我在我的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