Class: ActionLog

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/action_log.rb

Class Method Summary collapse

Class Method Details

.log(action, source, sender = nil, ip = nil, data = {}, admin_id = nil) ⇒ Object



4
5
6
7
# File 'app/models/action_log.rb', line 4

def self.log action, source, sender = nil, ip = nil, data = {}, admin_id = nil
  log = create! action: action, source: source, sender_id: sender.try(:id), sender_type: sender.try(:class).try(:name), ip: ip, data: data, admin_id: (admin_id.present? && admin_id.respond_to?(:id) ? admin_id.id : admin_id)
  Rails.logger.info log.inspect
end