ruby on rails - Add param to link_to show method -


i have current code in traders.index.html file

<ul> <% @traders.each |trader| %>   <li><%= link_to trader.name, trader %></li> <%end%> </ul> 

i want add parameter sent through, tried

<li><%= link_to trader.name, trader, {:restricted => params[:s]} %></li> 

but doesn't send parameter, whats actual format of link_to done?

you can do:

<%= link_to trader.name, trader_path(trader, restricted: params[:s]) %> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -