vergnaud thomas


20 Experience
0 Lessons Completed
0 Questions Solved


Posted in Liking Posts Discussion

Thk's for this very reactive answer, but i double checked on User Model, and i'v got the mention has_many :likes, if you have a another clue, i'am in, is that line correct : <% if user_signed_in? && current_user.likes?(@pin) %>
and this in my User Model :
has_many :likes
def likes?(pin)
pin.likes.where(user_id: id).any?

Posted in Liking Posts Discussion

Hey Chris,

First of all, thank's for the quality of your video.

Unfortunately I'am stuck in the middle of the video, i'am facing with this error : undefined method `likes' for, it highlights

<% if user_signed_in? && current_user.likes?(@pin) %>

@pin is the name for post in my app.
def likes? is written in the User model, could you explain why ?


Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.