Nice urls?

Can anyone please explain to me how to get ugly urls like :

hostname.com/browse/day?cal_name=name&day=9&month=6&year=2008

to be something nice like:

hostname.com/browse/name/day/month/year

or something like that?

I’ve read a bit about routes but I don’t see any examples anywhere
really of how to do this.

On Jun 5, 2008, at 2:42 PM, Amanda … wrote:

I’ve read a bit about routes but I don’t see any examples anywhere
really of how to do this.

map.connect ‘browse/:cal_name/:day/:month/:year’, :controller =>
‘browse’, :action => ‘day’

Assuming that the default route was picking up your example URL.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

map.connect ‘browse/:cal_name/:day/:month/:year’, :controller =>
‘browse’, :action => ‘day’

Assuming that the default route was picking up your example URL.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

where do I do that?

and also, since the :day, :cal_name etc are parameters would I have to
do ‘browse/params[:cal_name]/params[:day]/…’?

On Jun 5, 2008, at 3:00 PM, Amanda … wrote:

where do I do that?

In your project’s config/routes.rb file, of course.

oh lol thanks so much!

Amanda,

You may want to read into how you can setup customer routes using the
routes.rb files in rails… Furthermore you may want to read into
RESTful development, and how rails deals with Resources etc… might
help with your issue here.

There’s a TON of information on this on the net, and there’s just too
much to go through here…

Or, I find The Rails Way by Obie F. exceptionally clear on this
topic. Excellent book in many ways, but it seems to really shine on
routings.

Ron