Sha256: 2785251887ab365449604f95f1da6bf1c8532a6848b9c1c7dadde713b3c9cfb4

Contents?: true

Size: 516 Bytes

Versions: 1

Compression:

Stored size: 516 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 }

  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

1 entries across 1 versions & 1 rubygems

Version Path
tramway-page-1.5.1 app/models/tramway/page/page.rb