I've got a Rails 3.1 project that I'm working on, but I don't want controller_name.css.sass
and controller_name.js.coffee
to be generated each time I run rails generate controller controller_name
. I could swear I've seen the setting somewhere on the internet, but I can't find it now for the life of me. What is it?
Keep in mind that I'm still wanting to use the Asset Pipeline and the CoffeeScript/Sass integration, but I'm organizing those files in my own way.
I'm pretty sure the answer is a command line argument, but bonus points for turning it off with a generator setting or a hidden file or something.
EDIT: I've found the command line flag for it.
rails generate controller controller_name --assets=false
Or something of the like (that line actually errors out, but it also doesn't generate the assets). The API here shows :assets => true
as a default option. How do I change that to false and have it always be false every time I generate a controller?
New syntax is
rails generate controller Resources --no-assets
.Don't forget you can also use
g
in place ofgenerate
. And you can skip the creation of a controller helper using the--no-helper
flag.An update on @Dmitry Maksimov's answer for Rails 4.2. You can disable generation of controller-specific asset files by default with the following in your
config/application.rb
file (source: the guide):For just one time, use:
Add these lines to
application.rb
:My whole options: