Sha256: 3eca4da699c97349bd528efae7a73123e36c15ac4ef0223232b5a7aa782cb453

Contents?: true

Size: 445 Bytes

Versions: 5

Compression:

Stored size: 445 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
    paginates_per 5

    def should_generate_new_friendly_id?
      new_record? #Don't generate new id on edit
    end

    def save_as_draft
      self.published = false
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fuel-0.2.5 app/models/fuel/post.rb
fuel-0.2.4 app/models/fuel/post.rb
fuel-0.2.3 app/models/fuel/post.rb
fuel-0.2.2 app/models/fuel/post.rb
fuel-0.2.1 app/models/fuel/post.rb