LoginSignup
0
0

More than 3 years have passed since last update.

削除機能の追加方法

Posted at

削除機能の追加の備忘録です。

設定手順

① ルーティングの設定 
・httpメソッド 「delete」

②削除ボタンの作成 →ビューファイルの変更
 ・条件の指定に注意。(例:ログインユーザかつ投稿したユーザ❓)
 

③コントローラのアクション作成
 ・「destroy」メソッドの定義。
 ・削除権限を考える。例は②と同様。

④削除後のビューファイルの作成。
 ・コントローラのアクションが「destroy」なので、ファイル名は「destroy」をつける。
 ・トップページのURL作成。

0
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
0
0