Sha256: 7dd5e5f221a96f9b38bba2d19aababb1965df67e059c257ac2fcf9e1e55e87e0

Contents?: true

Size: 547 Bytes

Versions: 3

Compression:

Stored size: 547 Bytes

Contents

module Pulitzer
  class Version < ActiveRecord::Base
    enum status: [ :preview, :active, :archived, :abandoned, :processing ]
    has_many :content_elements, dependent: :destroy
    has_many :post_tags, dependent: :destroy
    belongs_to :post

    validates :post_id, :status, presence: true

    def content_element(label)
      self.content_elements.find_by(label: label)
    end

    def template_content_elements
      content_elements.template
    end

    def free_form_content_elements
      content_elements.free_form
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pulitzer-0.2.2 app/models/pulitzer/version.rb
pulitzer-0.2.1 app/models/pulitzer/version.rb
pulitzer-0.2.0 app/models/pulitzer/version.rb