Hi,
I have these entries in my routes.rb file:
map.connect '':id'',
:controller => ''wiki'',
:action => ''show'',
:id => /^([A-Z]\w*)+$/
map.connect '':controller/:action/:id''
map.connect '''',
:controller => ''wiki'',
:action => ''show'',
:id => ''HomePage''
I only want Rails to use the first route if :id is a camel-case word.
But for some reason, this route catches even when there is no :id
specified in the URL. So, the first route catches when the URL is
something like http://www.example.com/, and I receive an error, because
no :id parameter is specified in this case.
I would think that the regex in the first route would prevent this,
since:
irb(main):005:0> nil =~ /^([A-Z]\w*)+$/
=> false
irb(main):006:0> '''' =~ /^([A-Z]\w*)+$/
=> nil
irb(main):007:0> ''TestPage'' =~ /^([A-Z]\w*)+$/
=> 0
I must be missing something here, but I am not really sure what. If
anywould could offer any information about this, I would greatly
appreciate it.
Thanks,
Andrew
--
Posted via http://www.ruby-forum.com/.