Class: Decidim::ActionLog

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/action_log.rb

Overview

This class represents an action of a user on a resource. It is used for transparency reasons, to log all actions so all other users can see the actions being performed.

Instance Method Summary collapse

Instance Method Details

#log_presenter_class_for(log_type) ⇒ Object

Public: Finds the correct presenter class for the given ‘log_type` and the related `resource_type`. If no specific presenter can be found, it falls back to `Decidim::Log::BasePresenter`

log_type - a Symbol representing the log

Returns a Class.



53
54
55
56
57
# File 'app/models/decidim/action_log.rb', line 53

def log_presenter_class_for(log_type)
  resource_type.constantize.log_presenter_class_for(log_type)
rescue NameError
  Decidim::Log::BasePresenter
end

#readonly?Boolean

Overwrites the method so that records cannot be modified.

Returns a Boolean.

Returns:

  • (Boolean)


42
43
44
# File 'app/models/decidim/action_log.rb', line 42

def readonly?
  !new_record?
end