Rails 3: how to use active record and mongoid at the same time Rails 3: how to use active record and mongoid at the same time mongodb mongodb

Rails 3: how to use active record and mongoid at the same time


Well, to do it, you're supposed to leave Rails intact, so don't exclude libraries like it's commonly suggested in Mongoid documentation. You need to configure them separately, so you need to have a database.yml and mongo.yml config files and you need to make sure they're both getting loaded.

After that, you can enable/disable AR and Mongoid on a per-model basis.

class User < ActiveRecord::Base  #this is an AR modelendclass Item  include Mongoid::Document  #this is a Mongoid modelend