This project is archived and is in readonly mode.

#4966 ✓invalid
Neeraj Singh

routing constraints not working properly with regex

Reported by Neeraj Singh | June 25th, 2010 @ 05:26 AM | in 3.x

class UsersController < ApplicationController
  def show
    render :text => params[:id]
R4963::Application.routes.draw do |map|
  resources :users
  match 'person/:id' => 'users#show'

With the above routing rule I can hit http://localhost:3000/person/ME

Now I changed the routing rules and added constraints.

R4963::Application.routes.draw do |map|
  resources :users
  match 'person/:id' => 'users#show', :constraints => { :id => /[A-Z]/ }

Now if I try to hit http://localhost:3000/person/ME I get no route matches 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=""></a>