This project is archived and is in readonly mode.

#5274 ✓resolved
Jakub Suder

better error messages when incorrect regexp is passed to constraints in routes

Reported by Jakub Suder | August 2nd, 2010 @ 05:06 PM | in 3.0.2

The :constraints parameter in routes expects a regexp without the start/end markers (which is the opposite to e.g. the regexps passed to validation methods in ActiveModel). If you pass a full regexp like /^\w+$/, you get a strange exception message "undefined method include?' for #<Anchor "^">" coming from rack-mount.

It would be more consistent if the regexp style was the same in routes and in ActiveModel, but if that's not possible, then maybe Rails could print more meaningful error messages when incorrect regexp is passed to :constraints instead of that exception.

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>

Referenced by

Pages