Search

The Joyent Community

A place where the Joyent community can gather, help each other out, and stay informed.

You are not logged in.

#1 2007-01-18 07:16:30

dabux
Member
Registered: 2005-09-06
Posts: 83
Expertise

Rails 1.2 and "." in urls

Tonight i discovered that, with Rails 1.2, periods in urls don't work to well. After a little research i discovered the reason for that is because a period is now considered a separator in the route maps.

I have tried to work around this by using the :requirements hash in the routes.config. The best i could come up with is something like:

Code:

map.connect '/wiki/pages/:id', :controller => 'wiki_pages', 

:action => 'show', :requirements => {:id => /[+.a-zA-Z0-9]+/}


Were :id is the page title and titles are currently allowed to have periods in them. This doesn't work. I am not even sure this is the right path to head down.

Does anyone have any experience with this issue? Any insight would be wonderful.

Last edited by dabux (2007-01-18 07:17:14)

Offline

 

#2 2007-01-19 03:11:32

gabe
New member
Registered: 2006-12-30
Posts: 3
Expertise

Re: Rails 1.2 and "." in urls

You could do?

Code:

Regexp.new("[+.a-zA-Z0-9]+")

Offline

 

#3 2007-01-20 00:23:27

mlj
Member
From: Seattle, WA
Registered: 2006-01-31
Posts: 269
Expertise

Re: Rails 1.2 and "." in urls

The freshly released notes for 1.2 suggest doing something like

Code:

map.connect '/wiki/pages/:id', :controller => 'wiki_pages', :action => 'show', :requirements => { :id => /.*/ }


based on the route you've shown. A more traditional approach would be something like

Code:

map.connect '/wiki/pages/:id', :controller => 'wiki', :action => 'pages', :requirements => { :id => /.*/ }


but I presume you know what you're doing with your controllers and actions.


Michael

Offline

 

#4 2007-10-12 21:38:49

bsdwork
New member
Registered: 2007-10-12
Posts: 1
Expertise

Re: Rails 1.2 and "." in urls

Well I had some problems with the breakpointer.. but breakpointer replacement I use ruby-debug http://rubyforge.org/projects/ruby-debug/...Exact same functionality as the drb breakpointer with some extra features.More info: www.datanoise.com/ruby-debug/
Hope it's helpful.
Cheers


In the end, we will remember not the words of our enemies but the silence of our friends. - Martin Luther King
drug addiction treatment center

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson