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?

Rails6 link_toで作成したリンクをGETではなくPOSTにしたいとき

Last updated at Posted at 2020-02-17

目的

  • ページ内リンクでHTTPメッセージのGETではなくPOSTを送りたい時の方法をまとめる

書き方の例

  • 考え方は簡単で、POSTを送りたいlink_toに引数として{method: "post"}を与えてあげるだけである。

  • 下記にアプリ内URLにPOSTを送る時のlink_toの記載をする、

    link_to("表示されるリンク名", "POSTを送るURL", {method: "post"})
    
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?