TomLondon
TomLondon

Reputation: 35

undefined method `user_path' error

_app_views_pins__pin_html_erb__600263857_22928508 app/views/pins/_pin.html.erb

3     <p class="description">
4         <%= pin.description %>
5     </p>
6     <p>
7         <strong>
8             Posted by <%= link_to pin.user.name, pin.user %>
9         </strong>
10     </p>
11     <% if current_user == pin.user %>
12        <p>
13            <%= link_to 'Edit', edit_pin_path(pin) %>

Line 8 is the problem. Would be grateful for any suggestions. Thanks a lot!

Upvotes: 0

Views: 1612

Answers (1)

vich
vich

Reputation: 11896

The error is stating that pin.user isn't a route. The link_to helper requires a valid route.

Run rake routes to see which routes are available. Also, check out Rails Guides to become more familiar with Rails routing.

Upvotes: 2

Related Questions