remote: tureの概要
・非同期処理を行ないたいに使う
・link_to もしくは button_to で利用可能。
・button_toで可能ということは、submitでも可能?
Railsには、Ajax機能が組み込まれている
remote: ture オプションで非同期処理が可能。
リクエストが、HTML形式ではなくjs形式なる(ページ遷移をしなくなる)
参考URL:https://qiita.com/__tambo__/items/45211df065e0c037d032
メリット
Railsが自動的にAjaxでサーバにリクエストを送信してくれるため、AjaxのJavascriptコードを自分で書く必要がない
使い方
ex.)link_to の場合
<%= link_to post_favorite_path(@post),method: :delete do, remote: true %>
こんな感じだけど動作しない・・・ぐぬぬぬぬぬぬぬぬぬ