Sha256: af2ab5411d0c92b588d66f90d7513dd499b4fbadcc84f01e5fe874cdafb04675
Contents?: true
Size: 642 Bytes
Versions: 2
Compression:
Stored size: 642 Bytes
Contents
module Fuel class Post < ActiveRecord::Base extend FriendlyId friendly_id :title, use: :slugged if Rails.version[0].to_i < 4 attr_accessible :tag, :author, :content, :title end validates_presence_of :title, :content, :author, if: :is_published paginates_per Fuel.configuration.paginates_per.to_i scope :recent_published_posts, -> { where(published: true).order("created_at DESC") } def should_generate_new_friendly_id? new_record? #Don't generate new id on edit end def save_as_draft self.published = false end def is_published self.published end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fuel-0.3.3 | app/models/fuel/post.rb |
fuel-0.3.2 | app/models/fuel/post.rb |