aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorTekin Suleyman <tekin@tekin.co.uk>2015-01-21 15:40:02 +0000
committerTekin Suleyman <tekin@tekin.co.uk>2015-01-28 21:15:52 +0000
commitdb870f222e7ba4402590ee2f4143bcd40c3dbc56 (patch)
tree89888642a22a12b8ea4aa9b60b1f36de7d1c9a21 /actionpack/lib
parent82173989de711ecda71b7e887291a524c23c14ce (diff)
downloadrails-db870f222e7ba4402590ee2f4143bcd40c3dbc56.tar.gz
rails-db870f222e7ba4402590ee2f4143bcd40c3dbc56.tar.bz2
rails-db870f222e7ba4402590ee2f4143bcd40c3dbc56.zip
Preserve default url options when generating URLs
Fixes an issue that would cause default_url_options to be lost when generating URLs with fewer positional arguments than parameters in the route definition.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 7d8863dfe5..2b24b896db 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -264,9 +264,10 @@ module ActionDispatch
path_params -= controller_options.keys
path_params -= result.keys
end
- path_params.each { |param|
- result[param] = inner_options.fetch(param) { args.shift }
- }
+ path_params -= inner_options.keys
+ path_params.take(args.size).each do |param|
+ result[param] = args.shift
+ end
end
result.merge!(inner_options)