I am a begiiner in RoR. I am trying to create links on a page. I want multiple links on the page and pass a parameter to link's url based on which link was clicked.
I tried doind this:
routes.rb:
get '/search/facet/:param' => 'product_search#facet'
view:
<%= link_to "MORE", /search/facet/(param => taxon)
product_search_controler.rb:
def facet
@facetVariable = "hello"
@taxonVariable = params[:param]
end
But whenever I click on the MORE
link, I get a 404. Also, the linked page has url /search/facet
and not /search/facet/param=taxon
which I want.
Please could someone point out my mistake
<%=@facetVariable.inspect%>
<%=@taxonVariable.inspect%>`. It is showing nil for both variables
– nish Dec 02 '13 at 11:16