Skip to content

Commit

Permalink
Do not cache the script name outcome.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Sep 27, 2010
1 parent fe0251e commit 8aa3684
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions actionpack/lib/action_controller/metal/url_for.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ module UrlFor
include AbstractController::UrlFor

def url_options
@_url_options ||= begin
options = {}
if _routes.equal?(env["action_dispatch.routes"])
@_url_options ||= super.reverse_merge(
:host => request.host_with_port,
:protocol => request.protocol,
:_path_segments => request.symbolized_path_parameters
).freeze

if _routes.equal?(env["action_dispatch.routes"])
@_url_options.dup.tap do |options|
options[:script_name] = request.script_name.dup
options.freeze
end

super.merge(options).reverse_merge(
:host => request.host_with_port,
:protocol => request.protocol,
:_path_segments => request.symbolized_path_parameters
).freeze
else
@_url_options
end
end
end
Expand Down

0 comments on commit 8aa3684

Please sign in to comment.