Strange routing
- by astropanic
How I can setup my rails app to respond to such urls:
http://mydomain.com/white-halogene-lamp
http://mydomain.com/children-lamps
http://mydomain.com/contact-form
The first one should link to my products controller, and show my product with this name
The second one should link to my categories controller, and show the category with this name
The third one should link to my sites controller, and show the site with this title.
All three models (product, category, site) have a method to_seo, giving the mentioned above urls (after the slash)
I know it's not the restful way, but please don't disuss here, it is wrong approach or not, that's not the question.
The question is how to accomplish this weird routing ?
I know we have catch all routes, but how I can tell rails to use different controllers on different urls in the catch all route ? Or have You an better idea ?
I would avoid redirects to other urls.