How do I use the `--helper` flag in a rails 3 controller generator?

半城伤御伤魂 提交于 2020-01-03 08:48:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!