Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do not cache the script name outcome.

  • Loading branch information...
commit 8aa3684e07db81244c61c9ac98347831a976666b 1 parent fe0251e
@josevalim josevalim authored
Showing with 11 additions and 9 deletions.
  1. +11 −9 actionpack/lib/action_controller/metal/url_for.rb
View
20 actionpack/lib/action_controller/metal/url_for.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.