Sha256: 113be02d4f82990adbf23f12c9048461eaff25e74598fd13e45c1f615a0de679
Contents?: true
Size: 520 Bytes
Versions: 8
Compression:
Stored size: 520 Bytes
Contents
class Attaching < ActiveRecord::Base belongs_to :asset, :counter_cache => true belongs_to :attachable, :polymorphic => true def after_create if self.attachable.acts_as_polymorphic_paperclip_options[:counter_cache] self.attachable.class.increment_counter(:assets_count, self.attachable.id) end end def after_destroy if self.attachable.acts_as_polymorphic_paperclip_options[:counter_cache] self.attachable.class.decrement_counter(:assets_count, self.attachable.id) end end end
Version data entries
8 entries across 8 versions & 1 rubygems