Class: Raygun::Middleware::RailsInsertAffectedUser

Inherits:
Object
  • Object
show all
Defined in:
lib/raygun/middleware/rails_insert_affected_user.rb

Overview

Instance Method Summary collapse

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