aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-20 14:37:35 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-20 15:09:03 -0700
commit84bf3a08150e9e10a29282a7a671a052f00bcd31 (patch)
tree928b51c9dfb655bf2e54f5c146f0841dc3b4a6f6 /actionpack/lib
parent470c4dfe2d06a428af159f8688eb432529c61c2e (diff)
downloadrails-84bf3a08150e9e10a29282a7a671a052f00bcd31.tar.gz
rails-84bf3a08150e9e10a29282a7a671a052f00bcd31.tar.bz2
rails-84bf3a08150e9e10a29282a7a671a052f00bcd31.zip
fix variable names, only pass hashes to the positional args method
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index e699419f23..04332da5f7 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -226,21 +226,23 @@ module ActionDispatch
end
def call(t, args)
- options = t.url_options.merge @options
- hash = handle_positional_args(t, args, options, @segment_keys)
+ controller_options = t.url_options
+ options = controller_options.merge @options
+ hash = handle_positional_args(controller_options, args, options, @segment_keys)
t._routes.url_for(hash)
end
- def handle_positional_args(t, args, result, keys)
+ def handle_positional_args(controller_options, args, result, path_params)
inner_options = args.extract_options!
if args.size > 0
- if args.size < keys.size - 1 # take format into account
- keys -= t.url_options.keys
- keys -= result.keys
+ if args.size < path_params.size - 1 # take format into account
+ path_params -= controller_options.keys
+ path_params -= result.keys
end
- keys -= inner_options.keys
- result.merge!(Hash[keys.zip(args)])
+ path_params.each { |param|
+ result[param] = inner_options[param] || args.shift
+ }
end
result.merge!(inner_options)