From 6f3c8fbcd79610fb4411c3f7c07fc60ffd76b929 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 13 May 2014 11:15:23 -0700 Subject: use fewer method calls to determine the url_for options --- actionpack/lib/action_dispatch/routing/route_set.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 351079acc0..220de8dd93 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -224,19 +224,18 @@ module ActionDispatch end def call(t, args) - hash = handle_positional_args(t, args, @options, @segment_keys) - hash.reverse_merge!(t.url_options) + options = t.url_options.merge @options + hash = handle_positional_args(t, args, options, @segment_keys) t._routes.url_for(hash) end - def handle_positional_args(t, args, options, keys) + def handle_positional_args(t, args, result, keys) inner_options = args.extract_options! - result = options.dup if args.size > 0 if args.size < keys.size - 1 # take format into account keys -= t.url_options.keys - keys -= options.keys + keys -= result.keys end keys -= inner_options.keys result.merge!(Hash[keys.zip(args)]) -- cgit v1.2.3