LoginSignup
2
0

More than 3 years have passed since last update.

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

Posted at

目的

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

書き方の例

  • 考え方は簡単で、POSTを送りたいlink_toに引数として{method: "post"}を与えてあげるだけである。
  • 下記にアプリ内URLにPOSTを送る時のlink_toの記載をする、

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