Rails简单表单提交不向控制器发送值

时间:2017-07-23 18:47:02

标签: ruby-on-rails simple-form

我有一个问题,弄清楚为什么simple_form不发送文本框值。 The params are missing the raw_score

继承我的控制器 def创建     student_station_result = StudentStationResult.new

student = Student.find_by_register_no(params[:result_entry][:register_no])
student_sezzion_id = StudentSezzion.joins(:student_group).where(student_groups: { sezzion_id: params[:sezzion_id] }, student_id: student.id).pluck(:id).first

# TODO: Replaced after the NAPFA result calculation is done
student_station_result.station_point = 1
student_station_result.student_sezzion_id = student_sezzion_id
student_station_result.raw_score = params[:result_entry][:raw_score]
student_station_result.sezzion_station_id = params[:sezzion_station_id]
student_station_result.save!
end

继承我的HTML

= simple_form_for :result_entry, url: sezzion_sezzion_station_student_group_student_station_results_path do |f|
- @students.each do |student|
  - student_station_result = get_student_station_result(@station_id, student.id)
  .same-category
    .collapsible-container
        .collapsible-head
          .wrap
            .index
              h1 = student.register_no
            .name
              h3 = student.name
            .grade
              h1 = student_station_result[:performance_grade] if student_station_result.present?
              h5 = "x#{student_station_result[:raw_score]}" if student_station_result.present?
            .arrow
              #arrow-toggle =image_tag('arrow.svg', class: ['arrow-up', 'size'])

          .collapsible-body
            .grade-wrap
              .station-grade A: < 12.01s
              .station-grade B: 12.01 - 13.11
              .station-grade C: 13.11 - 14.11
              .station-grade D: 14.21 - 15.11
              .station-grade E: 15.31 - 16.51

            .score-input
              = f.input :raw_score, label: false, wrapper: false, input_html: { class: ['result-entry-textbox'], value: (student_station_result[:raw_score] if student_station_result.present?)}

              = f.input :register_no, as: :hidden, input_html: { value: student.register_no }
              = f.submit 'SAVE', class: ['result-entry-save', 'result-save-button']

帮助将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:1)

我找到了解决方案,实际上它非常愚蠢。因为

xbmc.executebuiltin("ActivateWindow(<window-id>,'plugin://<plugin-id>/<parameter-optional>',return)")
ex.
xbmc.executebuiltin("ActivateWindow(10025,'plugin://plugin.video.example/',return)")

位于页面顶部。因此,只允许提交最后一个字段。它应该放在simple_form块中。