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
Post a Comment