Sha256: c89dc1afde1c9cbdeac84064d28c765a544bc56d9445e1a6d7b418b67754c64a
Contents?: true
Size: 479 Bytes
Versions: 5
Compression:
Stored size: 479 Bytes
Contents
module Elabs class ProjectsArticle < ApplicationRecord self.table_name = 'projects_articles' belongs_to :project belongs_to :article after_create :increment_counter_cache after_destroy :decrement_counter_cache private def increment_counter_cache project.increment! :articles_count if article.publicly_visible? end def decrement_counter_cache project.decrement! :articles_count if article.publicly_visible? end end end
Version data entries
5 entries across 5 versions & 1 rubygems