Tuesday, March 3, 2009

SEOd URL using to_param method in RoR


The SEOd URL. Looks nice and clean " http://bizonnet.jaring.my/pages/9-adelia-power-services"



This the view. Note I use button_to helper instead of link_to.


The magic is in the mode, the to_param method.

Insetad of http://bizonnet.jaring.my/pages/9 , I would like a more nicer and meaningful URL like http://bizonnet.jaring.my/pages/9-adelia-power-services. So when the URL is being stored in Search Engine, people will know what's the page is all about. So How do I do that ?

First, add the to_param new defination to your model, and it's will be donw automatically.

No comments:

Post a Comment