Skip JSON format in rails generate scaffold

前端 未结 4 1366
南旧
南旧 2021-02-07 01:29

When you generate a rails scaffold using a command like rails g scaffold Thing is there any way to avoid getting that annoying

respond_to do |format         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 01:57

    Just clone the file

    https://github.com/rails/rails/blob/v5.2.2/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb

    to your

    lib/rails/generators/rails/scaffold_controller/templates/controller.rb
    

    path in your application and customize what you want. Also, you can write your own generators for scaffolding ( http://guides.rubyonrails.org/generators.html ).

提交回复
热议问题