1, a new rails app without active record
rails new template --skip-active-record
If you haven't installed mongoid, you should follow:
gem update --system
gem install mongo
gem install bson
gem install bson_ext
Official instruction: Mongo for Ruby
2, add mongoid and bson
add those two lines to Gemfile
# Use mongoid as the database solution
gem "mongoid", "~> 4.0.0"
gem 'bson', '~> 2.3.0'
bundle install
bundle install
rails g mongoid:config