When generating a model via Rails' generators, for instance rails g model
Project title complete:boolean
, Rails will also generate helpers and assets.
In most cases, we don't actually want these model specific files and end up
deleting them.
Is there a way we can prevent Rails from generating these files in the first place?
Sure is!
We can disable generation of helpers and assets using the following
configuration block in our config/application.rb
file:
config.generators do |generate|
generate.helper false
generate.assets false
end
Check out the [Rails guide to Configuring Generators][] for all the available generator specific options.
[Rails guide to Configuring Generators]: http://guides.rubyonrails.org/configuring.html#configuring-assets
Return to Flashcard Results