last post I wrote simple work on customizing rails routes now we will play more. It is easy and fun and more use full

this my main page and url is http://localhost:3000/mailheaders it is not cool URL for main page so how to change it.

image

open you config/routes.rb file in ROR project and add following to do it

map.connect('madhuka', {:controller => "mailheaders", :action => "index"})

image

woow.. it done.

so I need to change the url places in working on it

http:/ host/controller/action? params

eg: http://localhost:3000/message/givesentmessage?to=aaa

and lets change it as you wish (I am put params in url in midle)

http:/ host/controller/params/action

add this to routes.rb file

map.connect('messages/:to/giveMessages/', {:controller => "message", :action => "givesentmessage"})

image

woooww….. it is easy and very useful!!

0

Add a comment

I am
I am
Archives
Total Pageviews
Total Pageviews
2 0 5 7 7 0 6
Categories
Categories
Loading