1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Cache url_options on a per-request basis.

This commit is contained in:
thedarkone 2010-09-27 15:11:19 +02:00
parent 86bcccf8df
commit 8fdb34b237

View file

@ -5,16 +5,18 @@ module ActionController
include AbstractController::UrlFor
def url_options
options = {}
if _routes.equal?(env["action_dispatch.routes"])
options[:script_name] = request.script_name.dup
end
@_url_options ||= begin
options = {}
if _routes.equal?(env["action_dispatch.routes"])
options[:script_name] = request.script_name.dup
end
super.merge(options).reverse_merge(
:host => request.host_with_port,
:protocol => request.protocol,
:_path_segments => request.symbolized_path_parameters
)
super.merge(options).reverse_merge(
:host => request.host_with_port,
:protocol => request.protocol,
:_path_segments => request.symbolized_path_parameters
).freeze
end
end
end
end