Class: Workarea::AuditLogServerMiddleware

Inherits:
Object
  • Object
show all
Defined in:
app/middleware/workarea/audit_log_server_middleware.rb

Instance Method Summary collapse

Instance Method Details

#call(worker, msg, queue) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'app/middleware/workarea/audit_log_server_middleware.rb', line 3

def call(worker, msg, queue)
  return yield if msg['current_modifier_id'].blank?
  user = User.find(msg['current_modifier_id']) rescue nil

  if user.blank?
    yield
  else
    Mongoid::AuditLog.record(user) { yield }
  end
end