Class: AuditLog::Mapping
- Inherits:
-
Object
- Object
- AuditLog::Mapping
- Includes:
- Singleton
- Defined in:
- lib/audit_log/mapping.rb
Instance Attribute Summary collapse
-
#audit_mappings ⇒ Object
readonly
Returns the value of attribute audit_mappings.
Class Method Summary collapse
Instance Method Summary collapse
- #audit(model_class_name, options = {}) ⇒ Object
-
#initialize ⇒ Mapping
constructor
A new instance of Mapping.
- #join(*nested_audited_models) ⇒ Object
Constructor Details
#initialize ⇒ Mapping
Returns a new instance of Mapping.
14 15 16 |
# File 'lib/audit_log/mapping.rb', line 14 def initialize @audit_mappings = {} end |
Instance Attribute Details
#audit_mappings ⇒ Object (readonly)
Returns the value of attribute audit_mappings.
8 9 10 |
# File 'lib/audit_log/mapping.rb', line 8 def audit_mappings @audit_mappings end |
Class Method Details
Instance Method Details
#audit(model_class_name, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/audit_log/mapping.rb', line 18 def audit(model_class_name, = {}) @audit_mappings[model_class_name] = { ignored_fields: [:ignore] || [], nested_audited_models: [], controllers: [:controllers] || [model_class_name] } @current = @audit_mappings[model_class_name] self end |
#join(*nested_audited_models) ⇒ Object
29 30 31 32 |
# File 'lib/audit_log/mapping.rb', line 29 def join(*nested_audited_models) @current[:nested_audited_models] = nested_audited_models self end |