问题
The documentation from rails generate controller
says:
[--helper] # Indicates when to generate helper
# Default: true
Now, it doesn't specify how to indicate a value. So, since the default is true, that means that excluding it won't indicate false, because… true is the default. So it must either be --helper=false
or --helper false
, but I tried both, and they both resulted in error false [not found]
The good news is that it did not generate a helper, because it was confused, so I still got the result I wanted :)
回答1:
For the boolean options you can set it to false by prepending a --no_
Example:
rails generate controller book --no_helper
来源:https://stackoverflow.com/questions/4405242/how-do-i-use-the-helper-flag-in-a-rails-3-controller-generator