vergnaud thomas

Joined

20 Experience
0 Lessons Completed
0 Questions Solved

Activity

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?
end

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 ?

Cheers

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.