Hi,
I’m working on a Rails app for a cosmetologist:
my repository is here: https://github.com/acandael/beautysalonapp2
I created a Treatment model, wich belongs to a Category.
Then in my menu bar, I have a menu link for each Treatment category:
‘gelaatsverzorgingen’, ‘make-up’, ‘lichaamsbehandelingen’, …
(sorry guys, it’s in Dutch, translated, it means something like ‘facial treatments’, ‘make-up’, ‘body treatments’)
Then I defined routes for this:
get 'gelaatsverzorgingen/:category_id', to: 'treatments#index', as: 'gelaatsverzorgingen'
get 'make-up/:category_id', to: 'treatments#index', as: 'makeups'
get 'lichaamsbehandelingen/:category_id', to: 'treatments#index', as: 'lichaamsbehandelingen'
this results in url’s like:
http://localhost:3000/gelaatsverzorgingen/1
http://localhost:3000/make-up/2
http://localhost:3000/lichaamsbehandelingen/3
as you can see, the category_id is appended at the end of each url.
So my question is, if there is a way to get rid of this category_id at the end of the url’s, for human-friendly url’s and seo purposes, while still sending over the category_id to the TreatmensController, so I can have url’s like:
http://localhost:3000/gelaatsverzorgingen
http://localhost:3000/make-up
http://localhost:3000/lichaamsbehandelingen
thanks for your advice,
Anthony