如何更改 Formtastic 中使用的方法?
我想知道如何指定从 Formtastic 表单发送数据的方法。 它通常使用 POST,但我希望它在某些情况下使用 GET(即用于搜索表单)。
这可能/容易吗?
I was wondering how can I specify the method to send the data from a Formtastic form.
It usually uses POST, but I'd like it to use GET in some cases (i.e. for a search form).
Is it possible/easy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
semantic_form_for
标记中指定 :method,对于普通的 form_for 标记,它看起来像这样:<% form_for :post, @post, :url => post_path(@post), :html =>; {:方法=> :get } 做 |f| %>
我很确定它对于 Formtastic 表单同样有效。
You can specify the :method in the
semantic_form_for
tag, for a normal form_for tag it would look something like this:<% form_for :post, @post, :url => post_path(@post), :html => { :method => :get } do |f| %>
I'm pretty sure it works the same for Formtastic forms.