开发者

Combine MongoDB and Postgresql in Rails?

开发者 https://www.devze.com 2023-01-12 15:39 出处:网络
Is it possible to co开发者_如何学编程mbine AR with MongoMapper/MongoID? If so, are there tutorials/documentations for this?Yes, it is a piece of cake.There really isn\'t anything special you need to

Is it possible to co开发者_如何学编程mbine AR with MongoMapper/MongoID?

If so, are there tutorials/documentations for this?


Yes, it is a piece of cake. There really isn't anything special you need to do, just make models with the different adapters accordingly. This is an example Mongoid document:

class Project
  include Mongoid::Document
end

For comparison, here is activerecord:

class BillingEntry < ActiveRecord::Base
end

Just make sure not to mix them up. For example, don't include mongoid on a class that inherits from ActiveRecord::Base. I recommend Rails 3, as it's probably going to release this week, and the RCs have been really solid so far.


Yes it's possible. Can you please be more specific on what you want to achieve? It's even easier if you use Rails 3 because mongoid and ActiveRecords uses ActiveModel as the interface.

0

精彩评论

暂无评论...
验证码 换一张
取 消