Module: ActsAsLoggable

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

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#log_changes?Boolean

Disable logging of changes for this resource

Returns:

  • (Boolean)


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

def log_changes?
  true # Can be overridden to suppress logging
end

#log_changes_datatableObject



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

def log_changes_datatable
  # We use the changes_to_type and changes_to_id so that the bootstrap3 datatable is still aware of the resources
  EffectiveLogChangesDatatable.new(changes_to: self, changes_to_type: self.class.name, changes_to_id: id) if persisted?
end

#log_changes_formatted_attribute(attribute) ⇒ Object

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



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

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

#log_changes_formatted_value(attribute, value) ⇒ Object

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



68
69
70
# File 'app/models/concerns/acts_as_loggable.rb', line 68

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

#logs_datatableObject



72
73
74
# File 'app/models/concerns/acts_as_loggable.rb', line 72

def logs_datatable
  EffectiveLogsDatatable.new(for: self) if persisted?
end