Member-only story
Rails Generators - Configuration
This blog is a continuation of Rails Generators - Controllers
As convenient as generators in Rails are it’s very easy to get carried away cluttering your app with unnecessary code. Thankfully Rails offers us multiple ways to avoid this issue by giving us the option to leave out unneeded files and functionality.
Configurations handled in the application.rb file.
One way of doing this is providing your generation commands with flags, for example -T is the flag for excluding test files. However, this soon gets tiresome as your app grows in size, but fear not! We can configure rails generators to conditionally exclude unneeded code. This is done from our app’s application.rb file located at config > application.rb.
By default depending on what version of rails you are using your application class will look something like this.

I have edited my application class and added the following…
class Application < Rails::Applicationconfig.generators do |g|g.orm :active_record
g.template_engine :erb
g.test_framework :test_unit, fixture: false
g.stylesheets false
g.javascripts false end
end
So what is going on here? The config.generators do loop is fairly…