Ruby 2.6.5 Rails 6.0.3.3
I want to implement it so that only the poster can delete the review, but I get a NoMethodError
Initially, the conditional expression was described as follows.
<% if current_user.id == @review.user_id %>
This is a description that if the user who is currently logged in and the poster are the same, the conditional expression will be True and the process will be executed. However, when I read it with this description, an error occurred.
When I checked it, the description was as follows.
<% if user_signed_in? && current_user.id == @review.user_id %>
By confirming the presence or absence of login with this description, it is now possible to process normally. This is a rudimentary part, but I noticed it again, so I posted it as a memorandum.