Sha*_*aus 2 ruby ruby-on-rails mongodb mongoid ruby-on-rails-4
shaunstanislaus@Master ~/workspace/mongodb_rails_project/sodibee (master) $ rails g mongoid:config
Could not find generator 'mongoid:config'. Maybe you meant 'migration' or 'controller' or 'generator'
Run `rails generate --help` for more options
Run Code Online (Sandbox Code Playgroud)
好的,我解决了.
首先,我mongoid已经过时并正在使用1.0.6,最新的当前版本是4.0.1.
在宝石中指定mongoid,4.0.1
因此,它需要你也包括gem 'moped', '2.0.2'.
我假设你有bson和bson_ext太.
然后做:
spring stop
spring restart
Run Code Online (Sandbox Code Playgroud)
最后,尝试:
rails g mongoid:config
Run Code Online (Sandbox Code Playgroud)
你应该看到新文件:
create config/mongoid.yml
Run Code Online (Sandbox Code Playgroud)