嘿伙计们我是新手,所以对我很轻松。
我试图弄清楚如何将单选按钮选择传递给控制器。它不是模型的一部分。这是代码:
<%= radio_button_tag(:remove, "yes") %>
<%= label_tag(:yes_delete, "yes, delete the order") %>
<%= radio_button_tag(:remove, "no") %>
<%= label_tag(:no_dont_delete, "No, do not delete the order") %>
<h4 class="row"><td><%= link_to 'Delete', payment_path(:id => @payment.id), method: :delete, data: { confirm: 'Are you sure?' } %></td></h4>
当我点击删除所有这里是params的样子:
Parameters: "authenticity_token"=>"lfFsfN04ajhIpYI13bwhmGtLtQIdRUkaClPsBBP12SSZwDEnsIslOqH3yptGvWUF620bEYhPBgbD7sLYV2cA7Q==", "id"=>"175"}
感谢您的帮助。
答案 0 :(得分:1)
x <- 0:239
y <- c(12.32, 13.01, 12.32, 12.32, 12.32, 12.32, 13.01, 13.01, 12.32,
12.32, 12.32, 12.32, 12.32, 13.01, 12.32, 12.32, 12.32, 13.01,
12.32, 12.32, 12.32, 13.69, 13.69, 24.65, 39.71, 50.67, 76.69,
80.1, 98.6, 106.8, 109.6, 115, 116.4, 119.1, 123.2, 123.9, 131.5,
141.7, 143.8, 165, 180.8, 191.7, 212.9, 215.7, 231.4, 239, 241.7,
247.9, 250.6, 252, 255.4, 255.4, 258.1, 259.5, 259.5, 260.2,
261.6, 261.6, 263.6, 262.2, 263.6, 264.3, 264.3, 265, 265, 265,
265.7, 265, 264.3, 264.3, 265, 265, 265, 265, 264.3, 265, 264.3,
264.3, 263.6, 263.6, 263.6, 264.3, 263.6, 263.6, 262.2, 262.9,
262.2, 262.9, 261.6, 261.6, 260.9, 261.6, 260.9, 260.9, 260.2,
260.2, 259.5, 258.8, 258.8, 260.2, 258.1, 258.1, 258.1, 258.1,
258.1, 256.8, 256.8, 256.8, 256.1, 255.4, 255.4, 254.7, 254.7,
254, 254, 252.7, 253.3, 252.7, 252.7, 252, 12.32, 12.32, 12.32,
13.01, 13.01, 12.32, 13.01, 12.32, 12.32, 12.32, 12.32, 12.32,
11.64, 12.32, 12.32, 12.32, 12.32, 12.32, 12.32, 12.32, 13.69,
13.01, 16.43, 18.49, 32.87, 58.2, 62.31, 90.4, 104.1, 110.2,
130.8, 135.6, 156.1, 170.5, 173.9, 186.2, 195.8, 202, 220.5,
223.2, 249.2, 274.6, 279.4, 302.6, 312.9, 319.1, 328, 328.7,
336.2, 338.9, 340.3, 343, 345.1, 346.5, 348.5, 349.2, 350.6,
351.2, 351.2, 352.6, 353.3, 353.3, 354, 354, 354.7, 354.7, 355.4,
354.7, 354, 354.7, 354.7, 354.7, 354, 354, 354, 353.3, 354, 353.3,
353.3, 353.3, 351.9, 352.6, 351.9, 351.2, 351.2, 351.2, 350.6,
350.6, 349.2, 349.2, 348.5, 348.5, 348.5, 348.5, 347.1, 347.8,
345.8, 346.5, 346.5, 345.8, 344.4, 345.1, 344.4, 344.4, 343,
341.7, 342.3, 341.7, 341.7, 340.3, 341, 341, 339.6, 338.9, 338.9,
338.9, 338.2, 337.6, 337.6, 337.6)
可以轻松应对。
form_for
服务器收到的<%= form_for @payment, method: :delete do |f| %>
<%= radio_button_tag(:remove, "yes") %>
<%= label_tag(:yes_delete, "yes, delete the order") %>
<%= radio_button_tag(:remove, "no") %>
<%= label_tag(:no_dont_delete, "No, do not delete the order") %>
<h4 class="row"><td><%= f.submit 'Delete', data: { confirm: 'Are you sure?' } %></td></h4>
<% end %>
参数:
post