I have an app with nested resources - categories and services, so my
routes.rb contains the following
map.resources :categories do |category|
category.resources :services do |service|
Obviously this gives me urls like /categories/1/services/2
I would like to modify the app to display more human urls like
Or even better - /category_name/service_name
Both models have a name field in their database table.
Can anybody advise if there is a simple way to modify the routes.rb
and show actions in the controllers to set this up?
I feel like there must be a way to do this with minimal code and no
heavy lifting, but just can’t see it.