# Rails 2.1 Bug in Route Globbing

**URL:** <https://www.ruby-forum.com/t/rails-2-1-bug-in-route-globbing/145092>\
**Category:** Rails\
**Created:** [August 5, 2008, 11:23pm UTC](https://www.ruby-forum.com/t/rails-2-1-bug-in-route-globbing/145092 "2008-08-05T23:23:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [August 5, 2008, 11:23pm UTC](https://www.ruby-forum.com/t/rails-2-1-bug-in-route-globbing/145092/1 "2008-08-05T23:23:12Z")

</div>

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](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](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:  
[#144 Bug in Rails Route Globbing - Ruby on Rails - rails](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)

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [August 6, 2008, 3:05am UTC](https://www.ruby-forum.com/t/rails-2-1-bug-in-route-globbing/145092/2 "2008-08-06T03:05:43Z")

</div>

Following the advice here:  
[http://groups.google.com/group/WellRailed/browse\_thread/thread/b7b435f5b72bec5e](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)
