How to link the liked posts by each user?
I just finished with the Liking Posts screencast. All good. I managed to create a User Profile. And now I'm trying to display the liked post by each user.
I currently have this inside my user/show :
<% @user.likes.each do |like| %>
<h3> <%= link_to like.post.title %></h3>
<% end %>
Its listing each title liked by the user, but its now linking them to path of the post.
Any suggestions on how to solve this? Am I missing something inside the Like controllers?
Thanks (:
Hey Lauro,
link_to
requires two parameters, first the name, second the URL you want to point to. You've only passed in the name, so it's not going to link correctly for you. Try passing in a second parameter to get that working:
<h3> <%= link_to like.post.title, like.post %></h3>