This project is archived and is in readonly mode.

#5260 ✓duplicate
David Chelimsky

routing assertions do not support constraints

Reported by David Chelimsky | July 31st, 2010 @ 01:37 PM

# in config/routes.rb
match 'profile', :to => 'users#profile', :constraints => {:subdomain => /.+/ }
# in test/functional/profile_routing_test.rb
assert_generates "/profile", :controller => :users, :action => :profile
# result of running test
undefined method `subdomain' for #<Rack::Request:0x102ed9268>

It appears that routing assertions have not been updated along with changes to the router, and do not support constraints that interact with the request. Note that the error states Rack::Request, and not ActionDispatch::Request, which handles constraints like subdomain.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages