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

Ticket #10835: 0003-warning-about-optimization-in-RouteSet-recognize_pat.patch

File 0003-warning-about-optimization-in-RouteSet-recognize_pat.patch, 1.1 kB (added by oleganza, 6 months ago)

warns a developer that there's another version of recognize_path method elsewhere

  • a/actionpack/lib/action_controller/routing/route_set.rb

    old new  
    382382      end 
    383383 
    384384      def recognize_path(path, environment={}) 
    385         routes.each do |route| 
    386           result = route.recognize(path, environment) and return result 
    387         end 
    388  
    389         allows = HTTP_METHODS.select { |verb| routes.find { |r| r.recognize(path, :method => verb) } } 
    390  
    391         if environment[:method] && !HTTP_METHODS.include?(environment[:method]) 
    392           raise NotImplemented.new(*allows) 
    393         elsif !allows.empty? 
    394           raise MethodNotAllowed.new(*allows) 
    395         else 
    396           raise RoutingError, "No route matches #{path.inspect} with #{environment.inspect}" 
    397         end 
     385        raise "Not optimized! Check that routing/recognition_optimisation overrides RouteSet#recognize_path." 
    398386      end 
    399387 
    400388      def routes_by_controller