aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-10 16:24:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-10 17:57:17 -0700
commit7f3cfb606730965be690859a49236cf581fd469b (patch)
tree72ee47b2aafa9c496de3351d1abf5d1b1181377f /actionpack/lib/action_dispatch/routing/mapper.rb
parentf727bd24c211316a80b5d3c81e867f64d6ad7a09 (diff)
downloadrails-7f3cfb606730965be690859a49236cf581fd469b.tar.gz
rails-7f3cfb606730965be690859a49236cf581fd469b.tar.bz2
rails-7f3cfb606730965be690859a49236cf581fd469b.zip
always cast `name` to a symbol, and never to_s it
All callers of `action_path` interpolate the return value in to a string, so there is no need for the method to to_s it. to_sym on a symbol will return the same symbol, though I think `action_path` may always be called with a symbol so this might not be necessary.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 1c945dd496..c51be5d29f 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1743,8 +1743,7 @@ module ActionDispatch
end
def action_path(name) #:nodoc:
- name = name.to_sym if name.is_a?(String)
- @scope[:path_names][name] || name.to_s
+ @scope[:path_names][name.to_sym] || name
end
def prefix_name_for_action(as, action) #:nodoc: