如何在rails中检查check_box? [英] How to make a check_box checked in rails?
本文介绍了如何在rails中检查check_box?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下rails形式助手创建了复选框:
I made checkboxes using the following rails form helper:
<%= check_box("tag", tag.id) %>
但是,我需要使其中一些默认选中。 rails文档没有指定如何执行此操作。有办法吗?如何
However, I need to make some of them checked by default. The rails documentation doesn't specify how to do this. Is there a way? How?
推荐答案
check_box_tag
check_box 有一种方法可以设置它已被检查。
The check_box_tag
instead of check_box
has a way to set that it's been checked.
这篇关于如何在rails中检查check_box?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文