Class: Maglev::Page

Inherits:
ApplicationRecord show all
Includes:
PathConcern, SearchConcern, SectionsConcern, Translatable
Defined in:
app/models/maglev/page.rb

Defined Under Namespace

Modules: PathConcern, SearchConcern

Instance Method Summary collapse

Methods included from PathConcern

#current_path, #default_path, #disable_spawn_redirection, #path, #path=, #path_hash, #spawn_redirection_disabled?

Methods included from SectionsConcern

#prepare_sections, #prepare_sections_translations

Methods included from Translatable

#translate_attr_in, #translations_for

Instance Method Details

#homeObject

scopes ##



18
# File 'app/models/maglev/page.rb', line 18

scope :home, ->(locale = nil) { by_path('index', locale) }

#index?Boolean

methods ##

Returns:

  • (Boolean)


30
31
32
# File 'app/models/maglev/page.rb', line 30

def index?
  path == 'index'
end

#static?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/models/maglev/page.rb', line 34

def static?
  false
end

#titleObject

translations ##



12
# File 'app/models/maglev/page.rb', line 12

translates :title, presence: true

#translate_in(locale, source_locale) ⇒ Object



38
39
40
41
42
# File 'app/models/maglev/page.rb', line 38

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