A question on SO has this url structure:
http://stackoverflow.com/questions/18474799/changing-the-input-value-in-html5-datalist
If we assume that the number section is the ID, the first two sections (after the domain extension) are obtained by simply using the following in routes.rb
resources :questions
The question is already identified by it's ID, so how do we add the (optional) decorating slug in the simplest of manners? Do we need to use a new link helper (and including additional params) or can the 3-section url be resolved elsewhere?
Update:
To focus this question more on the route-handling, let's presume there is already a slug saved on the object (upon creation) as an attribute, e.g. @question.slug
It would really be an advantage if a rule in routes.rb
or/and in the controller could enable and handle the optional slug, instead of having to write long link helpers in all views.