Syntax to skip creating tests, assets & helpers for `rails generate controller`?

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?.


More concisely:

rails g controller home index --no-assets --no-test-framework

Applications which serve only API will not require javascript, stylesheet, views, helpers. To skip those files in generator/scaffold for Rails 3.x add the below code block in the application.rb

#to skip assets, scaffolds.css, test framework, helpers, view
config.generators do |g|
  g.template_engine nil #to skip views
  g.test_framework  nil #to skip test framework
  g.assets  false
  g.helper false
  g.stylesheets false
end

check the link for more details about generators


To turn off without having to add options:

# application.rb
config.generators.assets = false
config.generators.helper = false