aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-10-19 22:10:43 +0200
committerJosé Valim <jose.valim@gmail.com>2011-10-19 22:10:43 +0200
commit4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf (patch)
tree9563ee7b3c5c4d6ed633da8e8b6fe9d467cc3163
parentf1fecd9b4e38c289b678bc2aadb406265963c528 (diff)
downloadrails-4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf.tar.gz
rails-4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf.tar.bz2
rails-4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf.zip
Load object/blank and make use of presence.
-rw-r--r--actionpack/lib/action_dispatch/middleware/request_id.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/request_id.rb b/actionpack/lib/action_dispatch/middleware/request_id.rb
index f4d721f9bf..d7bb9c58df 100644
--- a/actionpack/lib/action_dispatch/middleware/request_id.rb
+++ b/actionpack/lib/action_dispatch/middleware/request_id.rb
@@ -1,5 +1,6 @@
require 'securerandom'
require 'active_support/core_ext/string/access'
+require 'active_support/core_ext/object/blank'
module ActionDispatch
# Makes a unique request id available to the action_dispatch.request_id env variable (which is then accessible through
@@ -26,8 +27,8 @@ module ActionDispatch
private
def external_request_id(env)
- if env["HTTP_X_REQUEST_ID"].present?
- env["HTTP_X_REQUEST_ID"].gsub(/[^\w\d\-]/, "").first(255)
+ if request_id = env["HTTP_X_REQUEST_ID"].presence
+ request_id.gsub(/[^\w\d\-]/, "").first(255)
end
end