Class: Raygun::Middleware::RailsInsertAffectedUser
- Inherits:
-
Object
- Object
- Raygun::Middleware::RailsInsertAffectedUser
- Defined in:
- lib/raygun/middleware/rails_insert_affected_user.rb
Overview
Adapted from the Rollbar approach github.com/rollbar/rollbar-gem/blob/master/lib/rollbar/middleware/rails/rollbar_request_store.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RailsInsertAffectedUser
constructor
A new instance of RailsInsertAffectedUser.
Constructor Details
#initialize(app) ⇒ RailsInsertAffectedUser
Returns a new instance of RailsInsertAffectedUser.
6 7 8 |
# File 'lib/raygun/middleware/rails_insert_affected_user.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/raygun/middleware/rails_insert_affected_user.rb', line 10 def call(env) @app.call(env) rescue Exception => exception controller = env["action_controller.instance"] affected_user_method = Raygun.configuration.affected_user_method if controller && controller.respond_to?(affected_user_method, true) user = controller.send(affected_user_method) env["raygun.affected_user"] = Raygun::AffectedUser.information_hash(user) end raise exception end |