Mongo, Mongoid and Rails 4.1
I typically forget to set the --skip-active-record
when creating a new app, so this is the
little kabuki dance you need to perform to get Mongoid to play nice with a freshly
created Rails 4.1 project.
Add mongoid to your Gemfile:
gem 'mongoid', '~> 4.0.0'
Generate your
mongoid.yml
configuration file:
rails g mongoid:config
Remove the sqlite gem now from your Gemfile:
gem 'sqlite3'
Delete
database.yml
Remove any lines that reference active_record from your environment files:
# development.rb
config.active_record.migration_error = :page_load
# production.rb
config.active_record.dump_schema_after_migration = false
6. Change this in your application.rb
:
require 'rails/all'
to:
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"