Class: Effective::Datatables::Logs
- Inherits:
-
Effective::Datatable
- Object
- Effective::Datatable
- Effective::Datatables::Logs
- Includes:
- EffectiveLoggingHelper
- Defined in:
- app/models/effective/datatables/logs.rb
Constant Summary
Constants included from EffectiveLoggingHelper
EffectiveLoggingHelper::ALLOWED_ATTRIBUTES, EffectiveLoggingHelper::ALLOWED_TAGS
Instance Method Summary collapse
-
#collection ⇒ Object
A nil attributes means give me all the top level log entries If we set a log_id then it’s for sub logs.
Methods included from EffectiveLoggingHelper
#bootstrap_class_for_status, #effective_logging_object_link_to, #effective_logging_simple_format, #format_log_details_value, #parents_of_log, #render_log, #tableize_hash
Instance Method Details
#collection ⇒ Object
A nil attributes means give me all the top level log entries If we set a log_id then it’s for sub logs
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/models/effective/datatables/logs.rb', line 42 def collection collection = Effective::Log.unscoped.where(parent_id: attributes[:log_id]).includes(:user, :associated) if attributes[:user_id].present? collection = collection.where(user_id: attributes[:user_id]) end if attributes[:user].present? collection = collection.where(user: attributes[:user]) end if attributes[:associated_id] && attributes[:associated_type] collection = collection.where(associated_id: attributes[:associated_id], associated_type: attributes[:associated_type]) end if attributes[:log_changes] collection = collection.where(status: EffectiveLogging.log_changes_status) end if attributes[:associated] collection = collection.where(associated: attributes[:associated]) end collection end |