Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11421 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Route requirements silently ignores Regexp modifiers

Reported by: NeilW Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords: unverified
Cc:

Description

Regexp modifier flags are silently dropped by the routing code both on the recognise and generate sides.

Workaround

Include the flag within the Regular expression:

:requirements => {:name => /david|jamis/i}

becomes

:requirements => {:name => /(?i:david|jamis)/}

The patch attached corrects the code so that it handles 'extended syntax' and 'ignorecase' modifiers correctly. The 'multiline' modifier will raise an ArgumentError. The Character Encoding modifiers are still silently discarded.

Attachments

handle_regexp_modifiers_in_route_requirements.diff (11.1 kB) - added by NeilW on 03/25/08 15:26:22.

Change History

03/25/08 15:26:22 changed by NeilW

  • attachment handle_regexp_modifiers_in_route_requirements.diff added.

03/25/08 15:32:21 changed by NeilW

  • keywords set to unverified.

03/28/08 20:01:25 changed by david

  • status changed from new to closed.
  • resolution set to fixed.

(In [9115]) Added support for regexp flags like ignoring case in the :requirements part of routes declarations (closes #11421) [NeilW]