in routes.rb I have such a line
resources :ideas
and in a view I have:
<%= link_to 'My ideas',ideas_path+'?id=my' %>
<%= link_to 'My ideas',ideas_path, :id=>'my' %>
first line opens: http://localhost:2000开发者_开发百科/ideas?id=my while the second opens: http://localhost:2000/ideas
How to fix the second line? Bye
<%= link_to 'My ideas',ideas_path(:id=>'my') %>
Rails paths sort out your paramaters for you.
To link to a single 'idea' you could do something like ...
<%= link_to 'One idea',idea_path(@idea) %>
To link to all your 'ideas' then
<%= link_to 'All ideas',ideas_path %>
精彩评论