Rails 2.1 Bug in Route Globbing

Given the route:
map.connect ‘*url’, :controller => ‘pages’, :method => :any, :action =>
‘show’
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’

Given the path http://127.0.0.1:3000/foo

Rails will correctly map the request to the pages controller

A path with any more segments (e.g. http://127.0.0.1:3000/foo/bar ) will
always
will always throw the error, “Only get, head, post, put, and delete
requests are allowed.”

If i remove the path globbing, I will get a correct
“No route matches “/foo/bar” with {:method=>:get}” Error

Updating to Edge Rails DOES solve this problem. I believe, but am not
sure, that this ticket is related to the issue:
http://rails.lighthouseapp.com/projects/8994/tickets/144-patch-bug-in-rails-route-globbing.
The patch in that issue is nearly identical to the 2.1.0 code, and it
would not apply in any case (probably because it’s not revision 9250)

However, I do not want to use Edge Rails in production, and additionally
Edge Rails causes problems elsewhere.

Does anyone have a solution to this issue?

(I also believe this issue is causing Safari on OSX to crash)

Following the advice here:
http://groups.google.com/group/WellRailed/browse_thread/thread/b7b435f5b72bec5e

seemed to work.

It would seem that in Rails 2.1 route globbing must be the very last
defined route (if it is not namespaced)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs