Rails编辑表单复选框未检查布尔值true

时间:2018-12-28 06:33:47

标签: checkbox ruby-on-rails-5

用户的编辑页面中有以下代码。

function customSubgroupOrder(a, b) {
  return b.subgroup - a.subgroup;
}

var items = [{
  id: 1,
  group: "X",
  content: "A",
  subgroup: 1,
  start: "2016-01-01",
  end: "2016-01-31"
}, {
  id: 2,
  group: "X",
  content: "B",
  subgroup: 2,
  start: "2016-01-15",
  end: "2016-02-29"
}, {
  id: 4,
  group: "X",
  content: "BB",
  subgroup: 2,
  start: "2016-01-19",
  end: "2016-02-21"
}, {
  id: 3,
  group: "X",
  content: "C",
  subgroup: 3,
  start: "2016-02-15",
  end: "2016-02-29"
}];
var groups = [{
  id: "X",
  content: "Custom Ordering<br>Top-to-Bottom",
  subgroupOrder: customSubgroupOrder
}];
var options = {
  stack: true
};

var el = document.getElementById('visualization');
var timeline = new vis.Timeline(el, items, groups, options);

@用户对象的pay_via_zelle在数据库中为真。

但是问题是当我访问用户编辑页面时,应该选中该复选框,但不是

这是上述表单生成的html输出

  = form_for @user do |f|
    .row
      .col-sm-4.col-md-4
        = f.label :pay_via_zelle, 'Pay Via Zelle:'
        = f.check_box :pay_via_zelle
    .row
      .col-sm-12.col-md-4
        = f.submit "Update", class: 'btn btn-primary form-control'

该复选框已选中='checked'属性,但未选中该复选框。

我错过了什么吗?

0 个答案:

没有答案