0

走る:

$ rails g scaffold User first_name:string last_name:string email:string website:string nodes:array links:array --orm=mongo_mapper

そして取得:

invoke  mongo_mapper
create    app/models/user.rb
(erb):1:in `template': undefined method `module_namespacing' for #<MongoMapper::Generators::ModelGenerator:0x000000035cd4a8> (NoMethodError)
...
from /home/thrive/.rvm/gems/ruby-1.9.2-p290@mlrepo/gems/mongo_mapper-0.11.1/lib/rails/generators/mongo_mapper/model/model_generator.rb:17:in `create_model_file'
...

完全なエラー出力...誰かがここで何が起こっているのか知っていますか?

つまり、ERBコードのように見える.rbファイルが含まれています。

<%= module_namespacing do - %>

ファイルの原因となるエラー:

4

1 に答える 1

1

'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
于 2012-05-15T14:47:41.520 に答える