diff options
author | José Valim <jose.valim@gmail.com> | 2011-10-19 22:10:43 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-10-19 22:10:43 +0200 |
commit | 4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf (patch) | |
tree | 9563ee7b3c5c4d6ed633da8e8b6fe9d467cc3163 /actionpack/lib/action_dispatch/middleware | |
parent | f1fecd9b4e38c289b678bc2aadb406265963c528 (diff) | |
download | rails-4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf.tar.gz rails-4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf.tar.bz2 rails-4ef74536940ea4c8c7f8c2cb0252bfe5f0db6fdf.zip |
Load object/blank and make use of presence.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/request_id.rb | 5 |
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 |