diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 16:21:06 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 17:57:17 -0700 |
commit | f727bd24c211316a80b5d3c81e867f64d6ad7a09 (patch) | |
tree | dbe72ff54dc1fe1a9d5e830083ba2d521b294234 /actionpack | |
parent | 9b3e5b0d029fe3a6bf3d090f60ee1f00134f5485 (diff) | |
download | rails-f727bd24c211316a80b5d3c81e867f64d6ad7a09.tar.gz rails-f727bd24c211316a80b5d3c81e867f64d6ad7a09.tar.bz2 rails-f727bd24c211316a80b5d3c81e867f64d6ad7a09.zip |
pull path conditional up
we only need to check for `path` once.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index a0d12144c4..1c945dd496 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1733,16 +1733,18 @@ module ActionDispatch end def path_for_action(action, path) #:nodoc: - if path.blank? && canonical_action?(action) + return "#{@scope[:path]}/#{path}" if path + + if canonical_action?(action) @scope[:path].to_s else - "#{@scope[:path]}/#{action_path(action, path)}" + "#{@scope[:path]}/#{action_path(action)}" end end - def action_path(name, path = nil) #:nodoc: + def action_path(name) #:nodoc: name = name.to_sym if name.is_a?(String) - path || @scope[:path_names][name] || name.to_s + @scope[:path_names][name] || name.to_s end def prefix_name_for_action(as, action) #:nodoc: |