2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ローカルではdeleteリクエストが飛ぶがHerokuではgetリクエストが飛んでしまう問題

Posted at

環境:Rails 7.1.2 
   sorcery 0.16.3

  • sorceryで認証機能(ログイン・ログアウト)を実装、ローカルで動作確認後herokuにpush。

  • ログアウトボタンを押下すると404 not foundと表示される。

<%= link_to 'LogOut', logout_path, data: { turbo_method: :delete }, class: 'nav-link' %>

ログを確認すると、logoutになぜかgetリクエストが送られている:sweat:

No route matches [GET] "/logout"

検証ツールで、ローカルおよびheroku上でlogoutボタンを確認しても差異を発見できず。

対処

button_to 'LogOut', logout_path, data: { turbo_method: :delete }, class: 'nav-link', method: :delete

上記のように書き直したらheroku上でも問題なく動作するようになった。

参考

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?