Class: Maglev::Page
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Maglev::Page
- Includes:
- PathConcern, PublishableConcern, SearchConcern, SectionsConcern, Translatable
- Defined in:
- app/models/maglev/page.rb
Defined Under Namespace
Modules: PathConcern, PublishableConcern, SearchConcern
Constant Summary
Constants included from PathConcern
PathConcern::COMMON_ASSOCIATION_PATH_OPTIONS
Instance Method Summary collapse
-
#home ⇒ Object
scopes ##.
-
#index? ⇒ Boolean
methods ##.
-
#sections_content_stores ⇒ Object
associations ##.
- #static? ⇒ Boolean
-
#title ⇒ Object
translations ##.
- #translate_in(locale, source_locale) ⇒ Object
Methods included from PublishableConcern
#apply_published_payload, #discard_draft?, #need_to_be_published?, #published?, #published_and_up_to_date?, #update_published_payload
Methods included from PathConcern
#canonical_path_hash, #current_path, #default_path, #disable_spawn_redirection, #path, #path=, #path_hash, #spawn_redirection_disabled?
Methods included from SectionsConcern
#delete_section, #find_section_block_by_id, #find_section_by_id, #find_sections_by_type, #position_of_section, #prepare_sections, #prepare_sections_translations, #reorder_sections, #section_ids
Methods included from Translatable
#translate_attr_in, #translations_for
Methods inherited from ApplicationRecord
Instance Method Details
#home ⇒ Object
scopes ##
41 |
# File 'app/models/maglev/page.rb', line 41 scope :home, ->(locale = nil) { by_path('index', locale) } |
#index? ⇒ Boolean
methods ##
53 54 55 |
# File 'app/models/maglev/page.rb', line 53 def index? path == 'index' end |
#sections_content_stores ⇒ Object
associations ##
32 |
# File 'app/models/maglev/page.rb', line 32 has_many :sections_content_stores, as: :container, dependent: :destroy |
#static? ⇒ Boolean
57 58 59 |
# File 'app/models/maglev/page.rb', line 57 def static? false end |
#title ⇒ Object
translations ##
35 |
# File 'app/models/maglev/page.rb', line 35 translates :title, presence: true |
#translate_in(locale, source_locale) ⇒ Object
61 62 63 64 65 |
# File 'app/models/maglev/page.rb', line 61 def translate_in(locale, source_locale) %i[title sections seo_title meta_description og_title og_description og_image_url].each do |attr| translate_attr_in(attr, locale, source_locale) end end |