日期:2014-05-16 浏览次数:20615 次
gem install rails
rails new project_name --skip-active-record
# require "rails/all" # 删除掉 # 添加下面 require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "rails/test_unit/railtie"
# Configure generators values. Many other options are available, be sure to check the documentation. # config.generators do |g| # g.orm :active_record # g.template_engine :erb # g.test_framework :test_unit, :fixture => true # end
source 'http://gemcutter.org' require 'rubygems' require 'mongo' gem "rails", "3.1.0" gem "mongo_mapper"
bundle install
gem install bundle
MongoMapper.connection = Mongo::Connection.new('localhost', 27017) MongoMapper.database = "project_name_#{Rails.env}" if defined?(PhusionPassenger) PhusionPassenger.on_event(:starting_worker_process) do |forked| MongoMapper.connection.connect if forked end end
namespace :db do namespace :test do task :prepare do # Stub out for MongoDB end end end
**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance. You can install the extension as follows: gem install bson_ext If you continue to receive this message after installing, make sure that the bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version. gems/ruby-1.9.2-p180/gems/execjs-1.3.0/lib/execjs/runtimes.rb:50:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from /home/chinacheng/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.3.0/lib/execjs.rb:5:in `<module:ExecJS>' from /home/chinacheng/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.3.0/lib/execjs.rb:4:in `<top (required)>'
gem install bson_ext
gem "bson_ext"
# Gems used only for assets and not required # in production environments by default. #group :assets do # gem 'sass-rails', " ~> 3.1.0" # gem 'coffee-rails', "~> 3.1.0" # gem 'uglifier' #end
gem 'therubyracer' gem 'execjs'
syntax error, unexpected ':', expecting kEND (SyntaxError)