Take the 2-minute tour ×

I read the help & tried the following command to skip generation of tests, assets & helper files

$ bin/rails generate controller home index  --helper false --assets false --controller-specs false --view-specs false   
create- app/controllers/home_controller.rb
        route  get "home/index"
        invoke  erb
        create    app/views/home
        create    app/views/home/index.html.erb
        invoke  rspec
        error  false [not found]
        error  false [not found]

As you may notice by output above this works & only controller, routes & views are generated. But as last two lines are interesting:

error  false [not found]
error  false [not found]

obviously rails doesn't seem to like --option-name false syntax. so this this error because I used the wrong syntax? If yes, then what is the correct way? Thanks

share|improve this question
add comment

2 Answers

up vote 43 down vote accepted

Try using --no- followed by optionname:

rails generate controller home index  --no-helper --no-assets --no-controller-specs --no-view-specs

If you want to change the default behavior every time you run the generator command, you can configure the defaults you would like in the application.rb file - see How can I make sure Rails doesn't generate spec tests for views and helpers?.

share|improve this answer
so --no-option-name is the syntax. Thanks –  CuriousMind Dec 27 '12 at 6:31
add comment

To turn off without having to add options:

# application.rb
config.generators.assets = false
config.generators.helper = false
share|improve this answer
thanks a lot :D saves a lot of typing :D –  Harsha M V Jun 18 at 13:27
@Kris please state your sources when editing tag wikis –  Rachel Gallen Jun 23 at 9:03
@RachelGallen sorry, what are you referring too? –  Kris Jun 23 at 9:38
@Kris i was reviewing your tag wikis today on Wisper. you didn't state any sources. –  Rachel Gallen Jun 23 at 9:43
Oh right, I thought it was in relation to this question. –  Kris Jun 23 at 13:41
add comment

Your Answer


