问题
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