如何在Rails 3中使用post/put simple_form传递get参数?

5
使用simple_form 2.0.4,我进行以下操作:
= simple_form_for(@thing) do |f|

它生成:
<form accept-charset="UTF-8" action="/things/37" class="simple_form" id="edit_thing_37" method="post" novalidate="novalidate">

但我需要:

<form accept-charset="UTF-8" action="/things/37?foo=bar" class="simple_form" id="edit_thing_37" method="post" novalidate="novalidate">

如何实现这个功能?

谢谢!

1个回答

16

你可以写

= simple_form_for(@thing, :url => thing_path(@thing, :foo => 'bar')) do |f|

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接