如何搭配的MongoDB和传统的DB在Rails的? [英] How to mix mongodb and a traditional db in Rails?

查看:135
本文介绍了如何搭配的MongoDB和传统的DB在Rails的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用的MongoDB(蒙戈映射器)为我的Rails应用程序的一部分。我不准备去整猪的MongoDB,因为有依赖于传统的DB太多有用的宝石。

I am considering using MongoDB (mongo-mapper) for a portion of my rails application. I am not ready to go whole hog MongoDB because there are too many useful gems that depend on a traditional DB.

话虽这么说有我的应用程序的一部分,将是巨大的,充分利用文档型数据库。

That being said there are parts of my application that would be great to leverage a document database.

有没有人成功过混合这两种方法?你如何链接ActiveRecord模型与mongomapper模式?

Has anyone had success mixing the two approaches? How do you link activerecord models with mongomapper models?

推荐答案

MongoMapper没有实现加载ActiveModel,但我觉得有GitHub上几个叉的事情。你可以使用Mongoid代替(它)和Mongoid文档和ActiveRecord的条目之间的关系也只是神奇的工作。我知道很多人都这样做。

MongoMapper doesn't implement ActiveModel yet, but I think there are a few forks on github that do. You could use Mongoid instead (which does) and your relationships between Mongoid docs and ActiveRecord entries would just magically work. I know a number of people are doing that.

不过,我不想将它们混合,除非我绝对必须有一个RDBMS的某些原因。

That said, I wouldn't want to mix them unless I absolutely had to have an RDBMS for some reason.

这篇关于如何搭配的MongoDB和传统的DB在Rails的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆