I’m trying to make a link in a page to another show page
here’s the code for the link:
<%= link_to c.name, companies_path(:id => c.id) %> # c is the name of my model object
here is the route I’ve set for the show page:
match '/companies/:id', to: 'companies#show'
when I type the url '/companies/:id' it takes me to the show page like I want but when I click the link it creates '/companies.":id"' instead.
I’m assuming that
cis a company object that you’re trying to link to – you should be able to link to the page you’re looking for usingcompanies_path(c), or even justc, like so: