0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ransackのsearch_form_forでmethodがgetに固定されてしまっていた話

Last updated at Posted at 2023-04-18

タイトルの通りですが、ransackのsearch_form_forでmethodをpatchに指定しているのに、ページを表示するとgetに固定されており、うまくいきませんでした。

index.html.slim
= search_form_for @nantoka, url: nantoka_path, class: 'search-form', method: :patch do |f|

解決方法

以下のようにhtml: {}の中に入れることで解決しました。他の機能ではhtlの中に入れなくても普通に動くものもあったのですがなぜか...原因不明...

method: :patch
↓
html: { method: :patch }
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?