Sha256: a8dce1a136f34dc1ee46bb1eee63643d3b88854eca7aa440b648987ada7a783b

Contents?: true

Size: 670 Bytes

Versions: 5

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

class Tramway::Page::Page < Tramway::ApplicationRecord
  has_many :blocks, -> { order(position: :asc) }, class_name: 'Tramway::Landing::Block'

  enumerize :page_type, in: %i[main other without_layout], default: :other

  scope :landings, -> { where page_type: :landing }
  scope :published, -> { where view_state: :published }

  aasm :view_state, column: :view_state do
    state :unpublished, initial: true
    state :published

    event :publish do
      transitions from: :unpublished, to: :published
    end

    event :hide do
      transitions from: :published, to: :unpublished
    end
  end

  aasm do
    state :hack
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tramway-page-1.6.0.6 app/models/tramway/page/page.rb
tramway-page-1.6.0.5 app/models/tramway/page/page.rb
tramway-page-1.6.0.4 app/models/tramway/page/page.rb
tramway-page-1.6.0.3 app/models/tramway/page/page.rb
tramway-page-1.6.0.2 app/models/tramway/page/page.rb