diff options
author | Roque Pinel <repinel@gmail.com> | 2015-07-01 16:13:20 -0500 |
---|---|---|
committer | Roque Pinel <repinel@gmail.com> | 2015-07-01 16:13:20 -0500 |
commit | da2aa295895bf24acc05d30d1350be99823520e0 (patch) | |
tree | 81fa8810f2ec062373f15d742cb130a81734f6b1 /actionpack/lib | |
parent | 776e5991a9abf11818cb803e80976cea8b454c17 (diff) | |
download | rails-da2aa295895bf24acc05d30d1350be99823520e0.tar.gz rails-da2aa295895bf24acc05d30d1350be99823520e0.tar.bz2 rails-da2aa295895bf24acc05d30d1350be99823520e0.zip |
Remove unnecessary `dup` from Mapper `add_route`
The `dup` was introduced by c4106d0c08954b0761726e0015ec601b7bc7ea4b
to work around a frozen key. Nowadays, the string is already being
duplicated by the `tr` in `options[:action] ||= action.tr('-', '_')`
and later joined into a new string in `name_for_action`.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 7cfe4693c1..ec530c6e8a 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1538,7 +1538,7 @@ module ActionDispatch path = path_for_action(action, options.delete(:path)) raise ArgumentError, "path is required" if path.blank? - action = action.to_s.dup + action = action.to_s if action =~ /^[\w\-\/]+$/ options[:action] ||= action.tr('-', '_') unless action.include?("/") |