Class: BetterRecord::LoggedAction

Inherits:
Base
  • Object
show all
Defined in:
app/models/better_record/logged_action.rb

Constant Summary collapse

ACTIONS =

Constants ============================================================

{
  D: 'DELETE',
  I: 'INSERT',
  U: 'UPDATE',
  T: 'TRUNCATE',
  A: 'ARCHIVE',
}.with_indifferent_access

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#dup, gender_enum, get_hashed_string, #get_hashed_string, #indifferent_attributes, set_audit_methods!

Class Method Details

.default_printObject

Class Methods ========================================================



37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/better_record/logged_action.rb', line 37

def self.default_print
  [
    :event_id,
    :row_id,
    :table_name,
    :app_user_id,
    :app_user_type,
    :action_type,
    :changed_columns
  ]
end

Instance Method Details

#action_typeObject



65
66
67
# File 'app/models/better_record/logged_action.rb', line 65

def action_type
  ACTIONS[action] || 'UNKNOWN'
end

#changed_columnsObject

Instance Methods =====================================================



61
62
63
# File 'app/models/better_record/logged_action.rb', line 61

def changed_columns
  (self.changed_fields || {}).keys.join(', ').presence || 'N/A'
end