Url reformatting

Hi,

I am new to ruby on rails and i have urls which are in the form of

http://demo.com/demo/home?demo=10 i want to reformat the above url to user friendly way like http://demo.com/demo/home/10

Is there any way how to do it.

Thanks Srikanth

Looks like named routes to me (code in routes.rb):

map.demo “/demo/home/:demo”, :controller => “demo”, :action => “home”

You can then just use “demo_path(:demo => 10)” in your controllers/views to get the url you want.

Though I think you’d be better off rethinking your whole app structure into something more RESTful. Getting a book on Rails (e.g. The Rails Way) could be a good idea.

Best regards

Peter De Berdt

Peter De Berdt wrote: