Sha256: ab5b39cd06ff55c68531ded2094f746d57f764fa8e2000d2b4ddddc5db03de77

Contents?: true

Size: 572 Bytes

Versions: 5

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

class Tramway::Page::Page < ::Tramway::Core::ApplicationRecord
  has_many :blocks, 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 }

  state_machine :view_state, initial: :unpublished do
    state :unpublished
    state :published

    event :publish do
      transition unpublished: :published
    end

    event :hide do
      transition published: :unpublished
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tramway-page-1.5.2.3 app/models/tramway/page/page.rb
tramway-page-1.5.2.2 app/models/tramway/page/page.rb
tramway-page-1.5.2.1 app/models/tramway/page/page.rb
tramway-page-1.5.2 app/models/tramway/page/page.rb
tramway-page-1.5.1.1 app/models/tramway/page/page.rb