1

我认为Haml中可能存在错误?或者我错过了表单标签应该包含输入元素,但它没有。

<form accept-charset="UTF-8" action="/remote_focus/kill_running_task" data-remote="true" method="get"></form>
            <tr>
              <td>...

我期望它在哪里

<form accept-charset="UTF-8" action="/remote_focus/kill_running_task" data-remote="true" method="get">
                <tr>
                  <td>...
</form>

这是我的haml文件,从数组中迭代每个任务,

  - @running_tasks.each do |running_task|        
    = form_tag kill_running_task_remote_focus_path, :method => :get, remote: true do
      %tr
        %td
          = running_task[:user]
        %td 
          = running_task[:ip]
        %td 
          = running_task[:time]
        %td 
          = running_task[:pid]
          = hidden_field_tag :task, running_task[:pid]
        %td
          = submit_tag "Kill This Task" ,:class=> "btn btn-primary autotest"
4

2 回答 2

0

尝试删除所有tr td并尝试一次。

于 2013-11-08T06:22:41.713 回答
0

除了 form 之外,更简单的标签是button_toor link_to。UJS 会自动将它们与remote: true和转换method: :delete为形式。所以

// Remove the previous form_tag
%td
  = button_to kill_running_task_remote_focus_path, :method => :delete, remote: true
于 2013-11-11T09:18:39.010 回答