Alex

Joined

370 Experience
3 Lessons Completed
0 Questions Solved

Activity

I get
undefined method `post' for #Comment:0x00007fb5e5880930

When i try to add a link_to in my _comment partial.

Basically the way i have it setup in the users show page, I've created a comments view /user/comments/id
it works

it links to the comments partial grabbing all the users comments on the application, the problem spans when i want to just link to the post.

<%= link_to post_path(comment.post) %>
in my partial

i just have <%= render @comments %> in the users comments html.erb.

in my users controller i have

def comments
@user = User.find_by_username(params[:id])
@comments = @user.comments.order('created_at DESC')
end

Am i on the right path here? Or complete off route. That you Chris

Hey there all, Would anyone know how you could go about linking to the commented on post? For example if you had a view on the users views for comments.. Listing all the comments by the user how would I attach the post title or link to the post?

Hey Chris i followed everything and used the source code yet the comments wont load with the JS. I have other elements on the web application that render find with no refresh ajax and all. I don't understand why this isn't working.. Please let me know if you have any ideas!! Thank you very much I hope you're doing well during this time. Thank you.