Rails 4 check_box_tag 禁用不工作?

Rails 4 check_box_tag disabled not working?

我认为有这个简单的标签:

<label class="checkbox_label">
     <%= check_box_tag 'view_accounts', :disabled => true  %>
      View Bank Accounts
</label> <br>

我试图禁用它,因为它只是一个 activerecord 的概览。但令我惊讶的是它不起作用。我尝试了我知道的所有格式来声明禁用复选框。

还有什么我想念的吗?

-使用Rails 4、Firefox

提前致谢!

check_box_tag

<%= check_box_tag 'view_accounts', 'true', false, :disabled => true  %>

需要 4 个参数

  • Field_name, ("view_accounts")

  • 选中时发送的值,(例如 -> params[:view_accounts] => 'true', on checked

  • 默认将复选框标记为 checked/unchecked(例如 -> true => checked, false => unchecked

  • 和HTML选项(例如->:disabled => true