Forum: Ruby on Rails Creating case-inensitive route components?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Df31a543d684be5fd6bc6c188d378615?d=identicon&s=25 stuart.hungerford (Guest)
on 2005-11-19 01:37
(Received via mailing list)
Hi,

On my new Rails based site I'd like to allow parts of the
URLs accepted to be case-insensitive.  That is, these should
all be accepted:

      http://example.org/foo/action
      http://example.org/Foo/action
      http://example.org/FOO/action

      etc.

I've setup a route like this in routes.rb:

ActionController::Routing::Routes.draw do |map|
     map.connect ':foo/something',
                 :foo => /foo/i,
                 :controller => 'foo',
                 :action => 'something'

     ...

But that doesn't seem to work for :foo components in anything
but lower case.

If I use this route:

ActionController::Routing::Routes.draw do |map|
     map.connect ':foo/something',
                 :foo => /[fF][oO][oO]/,
                 :controller => 'foo',
                 :action => 'something'

     ...

That does work.  Can someone explain what's happening here?

Stu
This topic is locked and can not be replied to.