ruby on rails - Strange routing -
How can I set up my rail app to respond to such URLs:
< / P>
The third person should link to my site administrator and show the site with this title.
All three models (product, category, site) have one method to-seo, the above URL (after the slash)
I know that this is not quietly, but Please do not abuse here, whether this is a wrong view or not, this is not a question.
The question is how to complete this weird routing?
I know that we capture all the routes, but how can I use different controllers on various URLs to capture all the rails? Or do you have a better idea?
I would like to avoid redirecting other URLs.
The best way is to add another layer, and to run such routes:
Because it can be done with:
Map. Product_seo "prodcuts /: Products",: Controller = & gt; : Product, Action = & gt; : Show
then change to # products in @ product = product.paint (parameter [: id])
to:
@ Product = product.find_b_name (param [: product]) if the consultation [: product] # it is assumed that the name is the area that you @ product = product. Looking at Search (Parameters [: ID])
In this way the old route still works, but you get the SEO URL.
Repeat for categories and change as needed (URL / Category / Children /
Comments
Post a Comment