How can i generate mongoid.yml config in Rail 2.3.5?

筅森魡賤 提交于 2019-12-23 17:29:05

问题


As the title says, how can i generate the default mongoid.yml config file on Rail 2.3.5?

I try to use the ´rails generate mongoid:config´ command but it just generates a new app.

And also, I would like to use has_many in mongoid without embedding the associated model in the same field. I would like them to be in separate fields and associated through a *_id "column". Is that possible?


回答1:


You can't. The master branch of MongoID is only Rails 3 compatible. If you want use mongoID with Rails 2.3.5, you need using the 1.0.x branch of MongoID.

In this version, there are no mongoid generator. You need define you own initializer to connect with MongoDB.



来源:https://stackoverflow.com/questions/2802087/how-can-i-generate-mongoid-yml-config-in-rail-2-3-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!