Module: AccessLogging::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/access_logging/controller.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#log_access(object = nil, verb = nil) ⇒ Object

An alternative to a controller-wide filter (above) – call something like ‘log_access(@report, ’transmogrifying’)‘ anywhere in an action.



44
45
46
47
48
49
50
# File 'lib/access_logging/controller.rb', line 44

def log_access(object=nil, verb=nil)
  return unless current_anyone
  AccessLog.log_request current_anyone, request, model: object, verb: verb
rescue => e
  # in production, don't kill the request just because logging failed
  raise e if Rails.env.development? || Rails.env.test?
end