Sha256: bfcc0c831adc7c4571d476e551894e44a97c24b1f688680337a506f9f82e5446
Contents?: true
Size: 445 Bytes
Versions: 5
Compression:
Stored size: 445 Bytes
Contents
module Elabs class AlbumsTag < ApplicationRecord self.table_name = 'albums_tags' belongs_to :album belongs_to :tag after_create :increment_counter_cache after_destroy :decrement_counter_cache private def increment_counter_cache tag.increment! :albums_count if album.publicly_visible? end def decrement_counter_cache tag.decrement! :albums_count if album.publicly_visible? end end end
Version data entries
5 entries across 5 versions & 1 rubygems