Sha256: 965e1f13817a6ecbd5e440e963e56baed9827a8cb6ea03b4976b24b7b9d2ccd6
Contents?: true
Size: 696 Bytes
Versions: 1
Compression:
Stored size: 696 Bytes
Contents
class Blog::Tagging < ActiveRecord::Base set_table_name :blog_taggings # -- Relationships -------------------------------------------------------- belongs_to :post belongs_to :tag, :counter_cache => true # -- Callbacks ------------------------------------------------------------ after_destroy :destroy_tag # -- Scopes --------------------------------------------------------------- scope :for_tags, includes(:tag).where('blog_tags.is_category' => false) scope :for_categories, includes(:tag).where('blog_tags.is_category' => true) protected def destroy_tag self.tag.destroy if !self.tag.is_category? && self.tag.taggings.count == 0 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comfy_blog-0.0.0 | app/models/blog/tagging.rb |