= f.check_box :split_funding, {class: "split_funding", :disabled => @survey.completed?, id: "split_funding_#{school.id}", "data-attribute" => "split_funding", "data-id" => school.id}
答案 0 :(得分:0)
将checked
属性传递给它:
= f.check_box :split_funding, {checked: @survey.split_funding, class: "split_funding", :disabled => @survey.completed?, id: "split_funding_#{school.id}", "data-attribute" => "split_funding", "data-id" => school.id}
我不确定你的意思是'如果对象是真的',所以我假设:split_funding
将返回true / false。如果它是关系,您可以在末尾链接:present?
以检查关系是否存在。