diff options
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index d380564c23..220de8dd93 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -171,8 +171,7 @@ module ActionDispatch def call(t, args) if args.size == arg_size && !args.last.is_a?(Hash) && optimize_routes_generation?(t) - options = @options.dup - options.merge!(t.url_options) + options = @options.merge t.url_options options[:path] = optimized_helper(args) ActionDispatch::Http::URL.url_for(options) else @@ -225,22 +224,18 @@ module ActionDispatch end def call(t, args) - options = handle_positional_args(t, args, @options, @segment_keys) - hash = { - :only_path => options[:host].nil? - }.merge!(options.symbolize_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)]) |