Class: Decidim::Plans::Loggability

Inherits:
Traceability
  • Object
show all
Defined in:
app/services/decidim/plans/loggability.rb

Overview

The loggability class modifies the core’s Traceability class by removing the PaperTrail tracing from the objects. This is needed because we want to handle the PaperTrail tracing manually for the plans.

Instance Method Summary collapse

Instance Method Details

#perform_action!(action, resource, author, extra_log_info = {}) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/services/decidim/plans/loggability.rb', line 9

def perform_action!(action, resource, author, extra_log_info = {})
  Decidim::ApplicationRecord.transaction do
    result = block_given? ? yield : nil
    loggable_resource = resource.is_a?(Class) ? result : resource
    log(action, author, loggable_resource, extra_log_info)
    return result
  end
end