- Extended by:
- Included in:
- , , ,
- Defined in:
This module is providing helpers for updating `ProjectStatistics` with `after_save` and `before_destroy` hooks.
It deals with `ProjectStatistics.increment_statistic` making sure not to update statistics on a cascade delete from the project, and keeping track of value deltas on each save. It updates the DB only when a change is needed.
class JobArtifact < include UpdateProjectStatistics update_project_statistics project_statistics_name: :build_artifacts_size end
`statistic_attribute` must be an ActiveRecord attribute
The model must implement `project` and `project_id`. i.e. direct Project relationship or delegation
Methods included from