aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-09-27 21:14:18 +0200
committerJosé Valim <jose.valim@gmail.com>2010-09-27 21:14:18 +0200
commit8aa3684e07db81244c61c9ac98347831a976666b (patch)
treeee6a3855336f89e845083f5966f4f67aaf85da5b
parentfe0251e408a8b5d1ee149c7cad7bcfc495ce1595 (diff)
downloadrails-8aa3684e07db81244c61c9ac98347831a976666b.tar.gz
rails-8aa3684e07db81244c61c9ac98347831a976666b.tar.bz2
rails-8aa3684e07db81244c61c9ac98347831a976666b.zip
Do not cache the script name outcome.
-rw-r--r--actionpack/lib/action_controller/metal/url_for.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb
index ef1071bb3d..333eeaeffb 100644
--- a/actionpack/lib/action_controller/metal/url_for.rb
+++ b/actionpack/lib/action_controller/metal/url_for.rb
@@ -5,17 +5,19 @@ module ActionController
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