Sha256: 73ed3aa9215e79aed25e1ac3ee22bfbc20e862b9d5da2680dc26c5207b179ff9
Contents?: true
Size: 1.11 KB
Versions: 15
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module Maglev class Page < ApplicationRecord ## concerns ## include Maglev::Translatable include Maglev::SectionsConcern include Maglev::Page::PathConcern include Maglev::Page::SearchConcern ## translations ## translates :title, presence: true translates :sections translates :seo_title, :meta_description translates :og_title, :og_description, :og_image_url ## scopes ## scope :home, ->(locale = nil) { by_path('index', locale) } scope :visible, -> { where(visible: true) } scope :by_id_or_path, lambda { |id_or_path, locale = nil| joins(:paths).where(id: id_or_path).or(core_by_path(id_or_path, locale)) } scope :by_path, ->(path, locale = nil) { core_by_path(path, locale).joins(:paths) } scope :core_by_path, lambda { |path, locale = nil| where(paths: { locale: locale || Maglev::I18n.current_locale, value: path }) } ## methods ## def index? path == 'index' end def static? false end end end
Version data entries
15 entries across 15 versions & 1 rubygems