In the routes file, I can easily put together a match that looks and works just fine
match '/:slug/:id' => "pages#show", :id => :id
the link in the view it works for is
link_to n.name, "/" + n.slug + "/" + n.id.to_s
I would prefer not to include the id in the url, so I was hoping to do something like
match '/:slug' => "pages#show", :slug => :slug
But the problem is that this does not indicate the identifier on the show controller page. Is there a way to use: slug to map it to a page in the database with that slug to find: id so that I can pass: id to the controller?
source share