From 8037d7eacd14376d2c093d27f5b7d18fed085916 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 8 Jun 2015 17:18:06 -0700 Subject: extract required_defaults from the conditions hash before constructing the route this way we can remove the strange "respond_to?" conditional in the `matches?` loop --- actionpack/lib/action_dispatch/routing/route_set.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index d0d8ded515..1e950d13f8 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -511,10 +511,11 @@ module ActionDispatch path = conditions.delete :path_info ast = conditions.delete :parsed_path_info + required_defaults = conditions.delete :required_defaults path = build_path(path, ast, requirements, anchor) conditions = build_conditions(conditions, path.names.map(&:to_sym)) - route = @set.add_route(app, path, conditions, defaults, name) + route = @set.add_route(app, path, conditions, required_defaults, defaults, name) named_routes[name] = route if name route end @@ -563,7 +564,7 @@ module ActionDispatch end conditions.keep_if do |k, _| - k == :action || k == :controller || k == :required_defaults || + k == :action || k == :controller || request_class.public_method_defined?(k) || path_values.include?(k) end end -- cgit v1.2.3