How can I get mongo mapper to generate the config/mongo.yml file in Rails 4

让人想犯罪 __ 提交于 2019-12-07 03:27:30

问题


I am trying to make a rails app using the Mongo Mapper gem. I am following the instructions in the Mongo Mapper Documentation.

Here is the link: Mongo Mapper Docs

First, I generated a new rails 4 app excluding activerecord.

rails new my_app --skip-active-record

In the next step I added the gem 'mongo_mapper' and gem 'bson_ext' and then bundled.

The next step is generating the config/mongo.yml file.

When I try to run the command:

script/rails generate mongo_mapper:config

I get this error:

Could not find generator mongo_mapper:config.

There is currently no information on installing Mongo Mapper with Rails 4 and I am not sure if I am missing something that changed from Rails 3 to 4.

How can I get mongo mapper to generate the config/mongo.yml file?


回答1:


I had to change my Gemfile to use a beta version of the Mongo Mapper gem to add support for Rails 4. Here is the updated Gemfile.

gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"


来源:https://stackoverflow.com/questions/18879866/how-can-i-get-mongo-mapper-to-generate-the-config-mongo-yml-file-in-rails-4

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