Sha256: b3c1e4d5c03f11401aad7318b65801de707df835827e6cbccf0f2749ca92fbfb
Contents?: true
Size: 925 Bytes
Versions: 1
Compression:
Stored size: 925 Bytes
Contents
class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord belongs_to :link_object, polymorphic: true enumerize :block_type, in: [ :header, :footer, :page, :cards, :features, :contacts, :news, :link ] enumerize :navbar_link, in: [ :exist, :not_exist ], default: :not_exist enumerize :link_object_type, in: [ 'Tramway::SportSchool::Document' ] mount_uploader :background, PhotoUploader state_machine :view_state, initial: :published do state :published state :hidden event :publish do transition hidden: :published end event :hide do transition published: :hidden end end scope :on_main_page, -> { active.where(view_state: :published).order :position } scope :with_navbar_link, -> { where navbar_link: :exist } scope :header, -> { on_main_page.where(block_type: :header).first } scope :footer, -> { on_main_page.where(block_type: :footer).first } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tramway-landing-1.2 | app/models/tramway/landing/block.rb |