如何在Rails 3控制器生成器中使用`--helper`标志? [英] How do I use the `--helper` flag in a rails 3 controller generator?

查看:58
本文介绍了如何在Rails 3控制器生成器中使用`--helper`标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

rails generate controller中的文档说:

[--helper]                # Indicates when to generate helper
                          # Default: true

现在,它没有指定如何指示值.因此,由于默认值为true,这意味着排除它不会表示false,因为……true是默认值.因此它必须是--helper=false--helper false,但是我都尝试了这两个方法,并且都导致了error false [not found]

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 :)

推荐答案

对于布尔选项,您可以在前面加上--no _

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

示例:

rails生成控制器手册--no_helper

rails generate controller book --no_helper

这篇关于如何在Rails 3控制器生成器中使用`--helper`标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆