From 7df7c707abff80ae28e8d1066b02cfdd91481a76 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 11 Aug 2015 14:03:13 -0700 Subject: one fewer hash mutation --- actionpack/lib/action_dispatch/routing/mapper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index a207349e11..e508b12350 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1579,8 +1579,10 @@ module ActionDispatch action = action.to_s + default_action = options.delete(:action) || @scope[:action] + if action =~ /^[\w\-\/]+$/ - options[:action] ||= action.tr('-', '_') unless action.include?("/") + default_action ||= action.tr('-', '_') unless action.include?("/") else action = nil end @@ -1591,8 +1593,6 @@ module ActionDispatch name_for_action(options.delete(:as), action) end - default_action = options.delete(:action) || @scope[:action] - mapping = Mapping.build(@scope, @set, URI.parser.escape(path), as, controller, default_action, options) app, conditions, requirements, defaults, as, anchor = mapping.to_route @set.add_route(app, conditions, requirements, defaults, as, anchor) -- cgit v1.2.3