如何更改 Formtastic 中使用的方法?

发布于 2024-08-13 01:53:25 字数 94 浏览 2 评论 0原文

我想知道如何指定从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘年祭陌 2024-08-20 01:53:25

您可以在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文