rails generate controller Home Index new create, would create the following set of files:
As one knows from experience, the helper; javascript and stylesheet files are not always used. In fact, most of the time, we would have a single stye.scss, and main.coffee that would take care of 95% of the total behaviour of our application. So, if we do not delete those files after generation, we would just end up with a lot of files in our system which would have no code throughout the life cycle of the program.
Fortunately, rails gives us the ability to customize its own generators so that we can disable these files from being generated. Once we place the below code in the application.rb
, it will stop the generation of these extra files.
config.generators do |g| g.helper false g.stylesheets false g.javascripts false g.view_specs false endNow, when you run
rails generate controller Home Index new create
, you will get less files.
]]>