Combine MongoDB and Postgresql in Rails?

Is it possible to combine AR with MongoMapper / MongoID?

If yes, is there a tutorial / documentation for this?

+5
source share
2 answers

Yes, this is a piece of cake. There really is nothing special you need to do, just make models with various adapters. This is an example of a Mongoid document:

class Project
  include Mongoid::Document
end

For comparison, activerecord acts here:

class BillingEntry < ActiveRecord::Base
end

Just be careful not to mix them. For example, do not include a mangoid in a class that inherits from ActiveRecord :: Base. I recommend Rails 3 because it is probably about to be released this week, and the RCs have been really strong so far.

+13

, . , ? , Rails 3, mongoid ActiveRecords ActiveModel .

+1

All Articles