Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't create view folder on rails generate controller

Is there a way with the usual generators config to turn OFF the creation of the view folders and action templates when you run a rails generate controller?

I can't find an option anywhere and the code here doesn't show me any pointers.

We are likely going to be building our own controller / resource generators at some point anyway, for our API, but I was curious if there was a way to turn off this annoyance in the meantime.

like image 421
Dave Sanders Avatar asked Aug 23 '13 15:08

Dave Sanders


1 Answers

It's not a well documented feature, but try to add --skip-template-engine (alias --no-template-engine) option to the command.

rails generate controller foo bar --skip-template-engine 

demo on a dummy app:

rails g controller my_controller index show --no-template-engine       create  app/controllers/my_controller_controller.rb        route  get "my_controller/show"        route  get "my_controller/index"       invoke  test_unit       create    test/functional/my_controller_controller_test.rb       invoke  helper       create    app/helpers/my_controller_helper.rb       invoke    test_unit       create      test/unit/helpers/my_controller_helper_test.rb       invoke  assets       invoke    coffee       create      app/assets/javascripts/my_controller.js.coffee       invoke    scss       create      app/assets/stylesheets/my_controller.css.scss 
like image 117
dimuch Avatar answered Oct 11 '22 17:10

dimuch