diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-11 14:03:13 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-11 14:49:19 -0700 |
commit | 7df7c707abff80ae28e8d1066b02cfdd91481a76 (patch) | |
tree | 849ba1d683df99aed1b9720368b12f24047710a5 /actionpack/lib | |
parent | 5935e4c882b89d539d7a1441263bc265d397cf8e (diff) | |
download | rails-7df7c707abff80ae28e8d1066b02cfdd91481a76.tar.gz rails-7df7c707abff80ae28e8d1066b02cfdd91481a76.tar.bz2 rails-7df7c707abff80ae28e8d1066b02cfdd91481a76.zip |
one fewer hash mutation
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
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) |