看起来名为“generator-parent-option”的边缘分支可以解决问题:
#/Gemfile
gem 'mongo_mapper', :git => 'git://github.com/bearded/mongomapper.git', :branch => 'generator-parent-option'
我跑了:
$ rails g scaffold User first_name:string last_name:string email:string website:string nodes:array links:array --skip-migration --orm=mongo_mapper
并得到了干净的输出:
thrive@thrive-laptop:~/rails_projects/hive$ rails g scaffold User first_name:string last_name:string email:string website:string nodes:array links:array --skip-migration --orm=mongo_mapper
invoke mongo_mapper
conflict app/models/user.rb
Overwrite /home/thrive/rails_projects/hive/app/models/user.rb? (enter "h" for help) [Ynaqdh] h
Y - yes, overwrite
n - no, do not overwrite
a - all, overwrite this and all others
q - quit, abort
d - diff, show the differences between the old and the new
h - help, show this help
Overwrite /home/thrive/rails_projects/hive/app/models/user.rb? (enter "h" for help) [Ynaqdh] Y
force app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
route resources :users
invoke scaffold_controller
identical app/controllers/users_controller.rb
invoke haml
exist app/views/users
identical app/views/users/index.html.haml
identical app/views/users/edit.html.haml
identical app/views/users/show.html.haml
identical app/views/users/new.html.haml
identical app/views/users/_form.html.haml
invoke test_unit
identical test/functional/users_controller_test.rb
invoke helper
identical app/helpers/users_helper.rb
invoke test_unit
identical test/unit/helpers/users_helper_test.rb
invoke stylesheets
identical public/stylesheets/scaffold.css