我安装了mongo mapper gem,版本是0.8.2。我打开environment.rb文件并编辑它以使用MongoMapper,如下所示:
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
config.gem 'mongomapper', :version => '>= 0.2.1'
config.frameworks -= [:active_record]
config.time_zone = 'UTC'
end
MongoMapper.database = "blog-#{Rails.env}"当我使用ruby script/server启动服务器时,我得到了以下异常:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
Missing these required gems:
mongomapper >= 0.2.1
You're running:
ruby 1.8.7.174 at /usr/local/bin/ruby
rubygems 1.3.7 at /Users/azamsharp/.gem/ruby/1.8, /usr/local/lib/ruby/gems/1.8发布于 2010-08-24 08:18:22
我想你可能漏掉了宝石名称中的下划线?
尝试:
# config/environment.rb
config.gem "mongo_mapper"https://stackoverflow.com/questions/3551058
复制相似问题