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:
parent
86bcccf8df
commit
8fdb34b237
1 changed files with 11 additions and 9 deletions
|
@ -5,6 +5,7 @@ module ActionController
|
||||||
include AbstractController::UrlFor
|
include AbstractController::UrlFor
|
||||||
|
|
||||||
def url_options
|
def url_options
|
||||||
|
@_url_options ||= begin
|
||||||
options = {}
|
options = {}
|
||||||
if _routes.equal?(env["action_dispatch.routes"])
|
if _routes.equal?(env["action_dispatch.routes"])
|
||||||
options[:script_name] = request.script_name.dup
|
options[:script_name] = request.script_name.dup
|
||||||
|
@ -14,7 +15,8 @@ module ActionController
|
||||||
:host => request.host_with_port,
|
:host => request.host_with_port,
|
||||||
:protocol => request.protocol,
|
:protocol => request.protocol,
|
||||||
:_path_segments => request.symbolized_path_parameters
|
:_path_segments => request.symbolized_path_parameters
|
||||||
)
|
).freeze
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue