Reputation: 111070
I'm outputting comments on a /books/1
I have the following:
<%= comment.user.id%> ---- This gives the correct user_id
What I want to do is create:
<%= link_to comment.user.fname, XXXXXXXXXXXXXX %>
What I don't know what to put for XXXXXXXXXXXXXX that links to /users/1 1 being the id from the comment.user.id
Ideas?
Upvotes: 1
Views: 233
Reputation: 39939
<%= link_to comment.user.fname, comment.user %>
Should do exactly what you want.
Upvotes: 5