Module: ActsAsLoggable

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/acts_as_loggable.rb

Defined Under Namespace

Modules: ActiveRecord, ClassMethods

Instance Method Summary collapse

Instance Method Details

#log_changes_datatable ⇒ Object



69
70
71
72
73
74
75
# File 'app/models/concerns/acts_as_loggable.rb', line 69

def log_changes_datatable
  return nil unless persisted?

  @log_changes_datatable ||= (
    EffectiveLogsDatatable.new(associated_id: id, associated_type: self.class.name, log_changes: true, status: false)
  )
end

#log_changes_formatted_attribute(attribute) ⇒ Object

Format the title of this attribute. Return nil to use the default attribute.titleize



56
57
58
59
60
# File 'app/models/concerns/acts_as_loggable.rb', line 56

def log_changes_formatted_attribute(attribute)
  if attribute == 'roles_mask' && defined?(EffectiveRoles) && respond_to?(:roles)
    'Roles'
  end
end

#log_changes_formatted_value(attribute, value) ⇒ Object

Format the value of this attribute. Return nil to use the default to_s



63
64
65
66
67
# File 'app/models/concerns/acts_as_loggable.rb', line 63

def log_changes_formatted_value(attribute, value)
  if attribute == 'roles_mask' && defined?(EffectiveRoles) && respond_to?(:roles)
    EffectiveRoles.roles_for(value)
  end
end

#refresh_datatables ⇒ Object



77
78
79
# File 'app/models/concerns/acts_as_loggable.rb', line 77

def refresh_datatables
  @refresh_datatables ||= [:effective_logs]
end