・ Ruby 2.5.7 ・ Rails 22.214.171.124
CRUD processing is done! However, at this rate, all posts can be edited or deleted. I want to make edit and delete permissions only for posters.
unless means if it wasn't. In the following, If the ID of the received user does not match the ID of the logged-in user (current_user), it means that the process will not be executed and the redirect will be returned.
before_action is the one that is executed before all the actions of the controller are executed. This time I want to do it only for editing and deleting, so I only edit, update and destroy.