Override default scaffold generator in rails 3

前端 未结 5 1325
一生所求
一生所求 2020-12-30 05:28

I\'ve created a generator for a controller in rails 3. Now I want to use this generator as the default generator when using the scaffolding generator.

Is that possib

5条回答
  •  忘掉有多难
    2020-12-30 06:25

    This seems to have changed slightly with Rails 4. You can see which template the generator will look for in the invoke line when the scaffold is generated, and your template folder name should match this:

    rails generate scaffold blub 
    ...
    invoke  responders_controller
    

    If you're using rails g scaffold_controller blubs the location of the template should be:

    lib/templates/rails/scaffold_controller/controller.rb
    

    If you're using rails g scaffold blub the location of the template should be:

    lib/templates/rails/responders_controller/controller.rb
    

提交回复
热议问题