Sha256: 995c2b63a845ebc025daa70a51ffd249890512b9f1cb298e3247414acc6e97a7
Contents?: true
Size: 455 Bytes
Versions: 7
Compression:
Stored size: 455 Bytes
Contents
class Odania::TagXref < ActiveRecord::Base belongs_to :tag, class_name: 'Odania::Tag' belongs_to :ref, polymorphic: true validates_presence_of :context validates_presence_of :tag_id validates_uniqueness_of :tag_id, :scope => [:ref_type, :ref_id, :context] after_destroy do tag.count = tag.tag_xrefs.count if tag.count.zero? tag.destroy else tag.save! end end after_create do tag.count = tag.tag_xrefs.count tag.save! end end
Version data entries
7 entries across 7 versions & 1 rubygems