Answer the question
In order to leave comments, you need to log in
@user = User.find(params[:id]) doesn't return user id, why?
And user_find_by_id doesn't work either.
Controller:
def show
@user = User.find(params[:id])
@comments = Comment.where(post_id: @post)
end
= link_to @post.user.name, user_path(@user)
Answer the question
In order to leave comments, you need to log in
Is it PostController? Then the error is that you are passing the post id to find, not the user.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question