Sha256: 1fba6e6f6ceb6614c6f81da1cb14287215d676ed1b7596812f820d123a54bcab

Contents?: true

Size: 630 Bytes

Versions: 6

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

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

  enumerize :page_type, in: %i[main other], 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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tramway-page-1.5.4.3 app/models/tramway/page/page.rb
tramway-page-1.5.4.2 app/models/tramway/page/page.rb
tramway-page-1.5.4.1 app/models/tramway/page/page.rb
tramway-page-1.5.4 app/models/tramway/page/page.rb
tramway-page-1.5.3.7 app/models/tramway/page/page.rb
tramway-page-1.5.3.6 app/models/tramway/page/page.rb