Sha256: f6b0f4f6e826cc12f0f09ca12613b0dc213ce7c59a95a7336e19fad2309d01d3

Contents?: true

Size: 255 Bytes

Versions: 3

Compression:

Stored size: 255 Bytes

Contents

class Monologue::Tag < ActiveRecord::Base
  validates :name, uniqueness: true,presence: true
  has_many :taggings
  has_many :posts,through: :taggings

  def posts_with_tag
    self.posts.published
  end

  def frequency
    posts_with_tag.size
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
monologue-0.5.0 app/models/monologue/tag.rb
monologue-0.4.1 app/models/monologue/tag.rb
monologue-0.4.0 app/models/monologue/tag.rb