Route globbing

3 views
Skip to first unread message

Will Bryant

unread,
Jul 27, 2008, 9:26:50 AM7/27/08
to WellRailed
Hi guys,

Is anyone else using route globbing (map.connect '*path')?

I feel like I must be missing something - it seems completely broken on both 2.1.0 and edge.  If I create a new blank project and then add the route:
  map.connect '*path', :controller => 'test', :action => 'test'
and then request /foo/bar, I get:

 ActionController::MethodNotAllowed

Only get, head, post, put, and delete requests are allowed.

RAILS_ROOT: /Users/will/routetest
Application Trace | Framework Trace | Full Trace

vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path'
vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:384:in `recognize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:154:in `handle_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281

vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path'
vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:384:in `recognize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:154:in `handle_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
vendor/rails/activesupport/lib/active_support/dependencies.rb:137:in `load_without_new_constant_marking'
vendor/rails/activesupport/lib/active_support/dependencies.rb:137:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:137:in `load'
vendor/rails/railties/lib/commands/servers/mongrel.rb:64
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require'
vendor/rails/railties/lib/commands/server.rb:49
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3

vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path'
vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:384:in `recognize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:154:in `handle_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
vendor/rails/activesupport/lib/active_support/dependencies.rb:137:in `load_without_new_constant_marking'
vendor/rails/activesupport/lib/active_support/dependencies.rb:137:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:137:in `load'
vendor/rails/railties/lib/commands/servers/mongrel.rb:64
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require'
vendor/rails/railties/lib/commands/server.rb:49
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3

Request

Parameters:

None

Show session dump

--- 
flash: !map:ActionController::Flash::FlashHash {}


Response

Headers:

{"cookie"=>[],
 "Content-Type"=>nil,
 "Cache-Control"=>"no-cache",
 "Allow"=>"GET,
 HEAD,
 POST,
 PUT,
 DELETE"}

Any suggestions?

Craig Hawkes

unread,
Jul 27, 2008, 4:56:14 PM7/27/08
to WellR...@googlegroups.com
Hi

Are you using Rails 2.1?

I was doing something similar to this in 2.0 and it was working fine,
then I upgraded to 2.1 and got the same error. I "fixed" this over the
weekend by moving the map.connect up in the list of routes to near the
top, but I have not looked into why this was happening yet.

Craig

Will Bryant

unread,
Jul 27, 2008, 8:01:24 PM7/27/08
to WellR...@googlegroups.com
On Mon, Jul 28, 2008 at 8:56 AM, Craig Hawkes <craig....@gmail.com> wrote:
Are you using Rails 2.1?

Yup.
 
I was doing something similar to this in 2.0 and it was working fine,
then I upgraded to 2.1 and got the same error.

Yeah, same here.
 
I "fixed" this over the
weekend by moving the map.connect up in the list of routes to near the
top, but I have not looked into why this was happening yet.

Hmm, it's already up the top for me.  Removing the default unnamed routes seems to help though.
Reply all
Reply to author
Forward
0 new messages