Sha256: 222f538356f215224de193153cb35baece60e22d8e845714f81f5434ad68a6dc

Contents?: true

Size: 536 Bytes

Versions: 1

Compression:

Stored size: 536 Bytes

Contents

module Georgia
  class Status < ActiveRecord::Base

    PUBLISHED = 'Published'
    DRAFT = 'Draft'
    PENDING_REVIEW = 'Pending Review'

    has_many :pages

    validates :name, presence: true

    scope :published, -> { where(name: PUBLISHED) }
    scope :draft, -> { where(name: DRAFT) }
    scope :pending_review, -> { where(name: PENDING_REVIEW) }

    def published?
      self.name == PUBLISHED
    end
    def draft?
      self.name == DRAFT
    end
    def pending_review?
      self.name == PENDING_REVIEW
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georgia-0.8.0 app/models/georgia/status.rb