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

Ticket #9777: fix_controller_segment_regexp_chunk_double_escape.diff

File fix_controller_segment_regexp_chunk_double_escape.diff, 1.4 kB (added by pythonic, 1 year ago)
  • trunk/actionpack/test/controller/routing_test.rb

    old new  
    879879class ControllerSegmentTest < Test::Unit::TestCase 
    880880   
    881881  def test_regexp_should_only_match_possible_controllers 
    882     ActionController::Routing.with_controllers %w(admin/accounts admin/users account pages) do 
     882    ActionController::Routing.with_controllers %w(admin/accounts admin/users account pages tasty-beverages) do 
    883883      cs = ROUTING::ControllerSegment.new :controller 
    884884      regexp = %r{\A#{cs.regexp_chunk}\Z} 
    885885       
  • trunk/actionpack/lib/action_controller/routing.rb

    old new  
    766766 
    767767    class ControllerSegment < DynamicSegment #:nodoc: 
    768768      def regexp_chunk 
    769         possible_names = Routing.possible_controllers.collect { |name| Regexp.escape name } 
    770         "(?i-:(#{(regexp || Regexp.union(*possible_names)).source}))" 
     769        "(?i-:(#{(regexp || Regexp.union(*Routing.possible_controllers)).source}))" 
    771770      end 
    772771 
    773772      # Don't URI.escape the controller name since it may contain slashes.