diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-20 21:58:22 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-20 21:58:22 +1100 |
commit | 8b37fee201bb3f41d3bc4557422c5f8b344f456c (patch) | |
tree | 5c24f3f85f10976b3407f557517dcccf0343cd72 /actionpack/lib/action_dispatch/middleware/notifications.rb | |
parent | c04baed627c85e586e337896d64f61f397554a46 (diff) | |
parent | 8a1be228491f433fa8d20be4f485e2159f5ebe59 (diff) | |
download | rails-8b37fee201bb3f41d3bc4557422c5f8b344f456c.tar.gz rails-8b37fee201bb3f41d3bc4557422c5f8b344f456c.tar.bz2 rails-8b37fee201bb3f41d3bc4557422c5f8b344f456c.zip |
Merge branch 'master' of git://github.com/rails/rails
Conflicts:
actionmailer/lib/action_mailer/base.rb
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/notifications.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/notifications.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/notifications.rb b/actionpack/lib/action_dispatch/middleware/notifications.rb index 01d2cbb435..c3776d53a8 100644 --- a/actionpack/lib/action_dispatch/middleware/notifications.rb +++ b/actionpack/lib/action_dispatch/middleware/notifications.rb @@ -8,17 +8,24 @@ module ActionDispatch @app = app end - def call(stack_env) - env = stack_env.dup - ActiveSupport::Notifications.instrument("action_dispatch.before_dispatch", :env => env) + def call(env) + payload = retrieve_payload_from_env(env) + ActiveSupport::Notifications.instrument("action_dispatch.before_dispatch", payload) - ActiveSupport::Notifications.instrument!("action_dispatch.after_dispatch", :env => env) do - @app.call(stack_env) + ActiveSupport::Notifications.instrument!("action_dispatch.after_dispatch", payload) do + @app.call(env) end rescue Exception => exception ActiveSupport::Notifications.instrument('action_dispatch.exception', - :env => stack_env, :exception => exception) + :env => env, :exception => exception) raise exception end + + protected + + # Remove any rack related constants from the env, like rack.input. + def retrieve_payload_from_env(env) + Hash[:env => env.except(*env.keys.select { |k| k.to_s.index("rack.") == 0 })] + end end end
\ No newline at end of file |