Sha256: 58c2e43a64136b13d9a0eabc996cb75d7c75508f27d3cf516f837379ce93911a

Contents?: true

Size: 488 Bytes

Versions: 10

Compression:

Stored size: 488 Bytes

Contents

module Jabe
  class Entry < ActiveRecord::Base
    before_save :set_published_at

    has_many :comments

    extend FriendlyId
    friendly_id :title, :use => :slugged

    acts_as_textiled :body

    default_scope :order => 'published_at DESC'
    scope :drafts, :conditions => { :draft => true }
    scope :published, :conditions => { :draft => false }

    private

      def set_published_at
        self.published_at = Time.now unless draft? || self.published_at
      end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jabe-0.9.1 app/models/jabe/entry.rb
jabe-0.9.0 app/models/jabe/entry.rb
jabe-0.8.0 app/models/jabe/entry.rb
jabe-0.7.0 app/models/jabe/entry.rb
jabe-0.6.5 app/models/jabe/entry.rb
jabe-0.6.4 app/models/jabe/entry.rb
jabe-0.6.3 app/models/jabe/entry.rb
jabe-0.6.2 app/models/jabe/entry.rb
jabe-0.6.1 app/models/jabe/entry.rb
jabe-0.6.0 app/models/jabe/entry.rb