Not only that, but the routes that include the resource names might be
very handy with respect to SEO. That is, you might get higher on a
list for someone searching for a "Simpsons episode..." if your url
If using the name, rather than the id, is something that you can
commit to as a universal design decision for your urls then there's a
pretty easy way to make the pretty urls without changing the routing.
ActiveRecord objects make use of the 'to_param' method when they are
used as parameters to a method call. By default they return the
record id. That's why the call:
comes out like /programmes/4/episodes/5
If you simply override the method then you can use the same routing
but the names instead:
(Having written that twice I see a refactoring coming on...
Now your call to episode_path should produce:
The remaining work to be done is to update your controllers, making
them capable of finding the objects based on the dasherized name.