I’ve just started using rails yesterday, so this is a kinda noob question
for example, a user is at http://www.example.com/name
and I want to make several links to http://www.example.com/name/:id
So I tried something like this:
<% @items.each do |item| %>
<%= link_to item.name, '/name' :id %>
<% end %>
I know, it was a complete guess on how I should write the code, but the restful code sends to a completely wrong link. How should I write this three lines?
Use the route helper:
ps: when you have a simple question like this one, take a look at this guide, you’ll often find the answer.