Sha256: 6a55c66a55be69d540aaee568b4eea5e257d9e2e73f144c081f582dde0081240

Contents?: true

Size: 688 Bytes

Versions: 4

Compression:

Stored size: 688 Bytes

Contents

=begin
  @Name    :BlogCategory model
  @Created at :12-06-2012
  @Updated at  :12-06-2012
  @Purpose :Needed for initailizing activerecord for blog_categories table in rails
  @Company : Mindfire Solutions
=end
class BlogCategory < ActiveRecord::Base
  extend FriendlyId
  friendly_id :title, use: :slugged
  
  #set table name prefix as mcms_
  self.table_name = 'mcms_blog_categories'
  
  #attribute accessibles
  attr_accessible :title

  #validation rules
  validates :title, :presence => true


  #model association rules
  has_many :categorizations
  has_many :posts, :through => :categorizations, :source => :blog_post

  def post_count
    posts.select(&:live?).count
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mcms_blog-1.0.0 app/models/blog_category.rb
mcms_blog-0.0.4 app/models/blog_category.rb
mcms_blog-0.0.3 app/models/blog_category.rb
mcms_blog-0.0.2 app/models/blog_category.rb