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