26
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Rails7のlink_toでmethod: :deleteする

Last updated at Posted at 2021-12-29

Rails7で

<%= link_to t("sign_out"), sign_out_path, method: :delete %>

しようとしたら動きませんでした。

代わりに

<%= link_to t("sign_out"), sign_out_path, data: { turbo_method: :delete } %>

を使えば良いようです。

※コントローラーのレスポンスにstatus: :see_otherをセットしないと悲惨なことになるようです。

詳しくは以下の記事にあります。

26
18
2

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
26
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?