diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-13 11:15:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-13 11:15:23 -0700 |
commit | 6f3c8fbcd79610fb4411c3f7c07fc60ffd76b929 (patch) | |
tree | dd45d1f387175dac110fc493f37a2dbc72863c5f /actionpack/lib/action_dispatch | |
parent | 48cce9d39985c834bdd44bfb09ba3c8172ca5a2d (diff) | |
download | rails-6f3c8fbcd79610fb4411c3f7c07fc60ffd76b929.tar.gz rails-6f3c8fbcd79610fb4411c3f7c07fc60ffd76b929.tar.bz2 rails-6f3c8fbcd79610fb4411c3f7c07fc60ffd76b929.zip |
use fewer method calls to determine the url_for options
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 9 |
1 files changed, 4 insertions, 5 deletions
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)]) |