我有一个表格,允许我的treatment_strategies表中的多个记录立即更新。它工作正常,但由于某种原因,它在视图本身的输入字段上方显示了大量文本。该文本似乎是所有对象本身:
[#<TreatmentStrategy id: 1, treatment_id: nil, agency_id: 1, name: "Develop agency leader characteristics supporting i...", selected: false, created_at: "2014-10-08 04:48:13", updated_at: "2014-10-08 04:59:48", specifics: "", implementer: "", use_currently: false, feasible: false, previous_success: false, recommended: false>, #<TreatmentStrategy id: 2, treatment_id: nil, agency_id: 1, name: "Recruit, designate, and train leaders for the chan...", selected: false, created_at: "2014-10-08 04:48:13", updated_at: "2014-10-08 04:59:48", specifics: "", implementer: "", use_currently: false, feasible: false, previous_success: false, recommended: false>, #<TreatmentStrategy id: 3, treatment_id: nil, agency_id: 1, name: "Leaders mandate the use of the intervention strate...", selected: false, created_at: "2014-10-08 04:48:13", updated_at: "2014-10-08 04:59:48", specifics: "", implementer: "", use_currently: false, feasible: false, previous_success: false, recommended: false>, #<TreatmentStrategy id:
如何摆脱所有文字?
这是我的代码:
= form_tag update_individual_treatment_strategies_path, :method => "put", :id => "myForm" do |f|
= for treatment_strategies in @current_agency.treatment_strategies.order('created_at ASC')
=fields_for "treatment_strategies[]", treatment_strategies do |f|
%tr
%td
= treatment_strategies.name
%td
.custom-cell-left
= f.check_box :use_currently
Use Currently
%br
= f.check_box :previous_success
Previous success
.custom-cell-right
= f.check_box :feasible
Feasible
%br
= f.check_box :recommended
Recommended
%td.text-center
= f.check_box :selected
%td
= f.text_area :specifics
%td
= f.text_field :implementer
= submit_tag 'Save', class: 'btn btn-primary', style: "display:none;"
答案 0 :(得分:0)
知道了:我必须将“=”切换为“ - ”行:
= @ current_agency.treatment_strategies.order('created_at ASC')中的treatment_strategies
仍在拨打HAML ......