Permalink
Browse files

use fewer method calls to determine the url_for options

  • Loading branch information...
1 parent 48cce9d commit 6f3c8fbcd79610fb4411c3f7c07fc60ffd76b929 @tenderlove tenderlove committed May 13, 2014
Showing with 4 additions and 5 deletions.
  1. +4 −5 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -224,19 +224,18 @@ def initialize(route, options)
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)])

0 comments on commit 6f3c8fb

Please sign in to comment.