如何在rails 3控制器生成器中使用`--helper`标志?

时间:2022-08-10 19:40:20

The documentation from rails generate controller says:

rails生成控制器的文档说:

[--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]

现在,它没有指定如何指示值。因此,由于默认值为true,这意味着排除它不会指示false,因为... true是默认值。所以它必须是--helper = false或--helper false,但我尝试了两者,并且它们都导致错误[未找到]

The good news is that it did not generate a helper, because it was confused, so I still got the result I wanted :)

好消息是它没有生成帮助器,因为它很混乱,所以我仍然得到了我想要的结果:)

1 个解决方案

#1


10  

For the boolean options you can set it to false by prepending a --no_

对于布尔选项,您可以通过添加--no_将其设置为false

Example:

rails generate controller book --no_helper

rails生成控制器书--no_helper

#1


10  

For the boolean options you can set it to false by prepending a --no_

对于布尔选项,您可以通过添加--no_将其设置为false

Example:

rails generate controller book --no_helper

rails生成控制器书--no_helper