Sha256: 2abf8144ffb8feff2fa008d2df17e9ae9dc62cbebc77d79d4a8bd2b7a477d813

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

module RaffleV1
  class Page < ActiveRecord::Base
    attr_accessible :archived, :body, :deleted_at, :expiration_date, :footer, :header, 
      :method, :nav, :override_page, :page_status, :page_to_override, :page_type, :points,
      :program_id, :publish_date, :status, :item_status, :title

    belongs_to :program
    belongs_to :page_layout

    validates :expiration_date, :item_status, presence: true
    validates :publish_date, date: { before: :expiration_date, message: "must be before expiration date" }

    #validate :ensure_content, if: Proc.new{|x| x.deleted_at == nil }

    scope :published, where('published_date IS NOT AND publish_date <= (?) AND expiration_date IS NOT NULL AND expiration_date >= (?)', Date.today, Date.today)
    .order("publish_date DESC")

    TYPES = ['Free Form', 'Pre-Defined', 'Snippet', 'Content Box']

    #def ensure_content
      #if translations.present?

      #end
    #end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
raffle_v1-0.0.5 app/models/raffle_v1/page.rb