[Ruby] How to add the delete function

less than 1 minute read

This is an additional memorandum of the delete function.

Setup steps

① Routing settings
-Http method “delete”

② Create delete button → Change view file
・ Be careful when specifying conditions. (Example: Login user and posting user ❓)
 

③ Create controller action
-Definition of “destroy” method.
・ Consider the delete authority. The example is the same as ②.

(4) Creating a view file after deletion.
-Since the action of the controller is “destroy”, add “destroy” to the file name.
-Create URL for the top page.