Sha256: 121be3fadd455645b18173011a384ddb93f477696617c0f323070f3c398fbbb6
Contents?: true
Size: 966 Bytes
Versions: 7
Compression:
Stored size: 966 Bytes
Contents
module ActsAsTaggableOn class Tagging < ::ActiveRecord::Base #:nodoc: attr_accessible :tag, :tag_id, :context, :taggable, :taggable_type, :taggable_id, :tagger, :tagger_type, :tagger_id if defined?(ActiveModel::MassAssignmentSecurity) belongs_to :tag, :class_name => 'ActsAsTaggableOn::Tag' belongs_to :taggable, :polymorphic => true belongs_to :tagger, :polymorphic => true validates_presence_of :context validates_presence_of :tag_id validates_uniqueness_of :tag_id, :scope => [ :taggable_type, :taggable_id, :context, :tagger_id, :tagger_type ] after_destroy :remove_unused_tags private def remove_unused_tags if ActsAsTaggableOn.remove_unused_tags if tag.taggings.count.zero? tag.destroy end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems