diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2014-03-03 20:19:17 +0200 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-03-08 19:51:06 +0000 |
commit | 8711086f5a2e73cd068434a5fafef258ba9f4fe1 (patch) | |
tree | 10f25d0685c0f7071b6e7cd23c9dcfb5f1374c76 /actionpack/lib | |
parent | dcc91a04a177466516dac12abc358c590743fa71 (diff) | |
download | rails-8711086f5a2e73cd068434a5fafef258ba9f4fe1.tar.gz rails-8711086f5a2e73cd068434a5fafef258ba9f4fe1.tar.bz2 rails-8711086f5a2e73cd068434a5fafef258ba9f4fe1.zip |
Pull namespace defaults out of the options hash
If a developer has specified either :path or :as in the options hash then
these should be used as the defaults for :shallow_path and :shallow_prefix.
Fixes #14241.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 314b966bb0..1ad419ec80 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -792,9 +792,16 @@ module ActionDispatch # end def namespace(path, options = {}) path = path.to_s - options = { :path => path, :as => path, :module => path, - :shallow_path => path, :shallow_prefix => path }.merge!(options) - scope(options) { yield } + + defaults = { + module: path, + path: options.fetch(:path, path), + as: options.fetch(:as, path), + shallow_path: options.fetch(:path, path), + shallow_prefix: options.fetch(:as, path) + } + + scope(defaults.merge!(options)) { yield } end # === Parameter Restriction |