Class: Maglev::Site
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Maglev::Site
- Includes:
- SectionsConcern, LocalesConcern, Translatable
- Defined in:
- app/models/maglev/site.rb
Defined Under Namespace
Modules: LocalesConcern Classes: Locale, StyleValue
Instance Method Summary collapse
- #api_attributes ⇒ Object
- #find_section(type) ⇒ Object
-
#name ⇒ Object
validations ##.
-
#published? ⇒ Boolean
methods ##.
-
#sections ⇒ Object
translations ##.
-
#sections_content_stores ⇒ Object
associations ##.
-
#style ⇒ Object
force JSON columns for MariaDB ##.
- #translate_in(locale, source_locale) ⇒ Object
Methods included from Translatable
#translate_attr_in, #translations_for
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 LocalesConcern
#add_locale, #default_locale, #default_locale_prefix, #each_locale, #locale_prefixes, #many_locales?
Methods inherited from ApplicationRecord
Instance Method Details
#api_attributes ⇒ Object
43 44 45 |
# File 'app/models/maglev/site.rb', line 43 def api_attributes %i[id name] end |
#find_section(type) ⇒ Object
47 48 49 |
# File 'app/models/maglev/site.rb', line 47 def find_section(type) sections&.find { |section| section['type'] == type } end |
#name ⇒ Object
validations ##
35 |
# File 'app/models/maglev/site.rb', line 35 validates :name, presence: true |
#published? ⇒ Boolean
methods ##
39 40 41 |
# File 'app/models/maglev/site.rb', line 39 def published? published_at.present? end |
#sections ⇒ Object
translations ##
32 |
# File 'app/models/maglev/site.rb', line 32 translates :sections |
#sections_content_stores ⇒ Object
associations ##
25 |
# File 'app/models/maglev/site.rb', line 25 has_many :sections_content_stores, as: :container, dependent: :destroy |
#style ⇒ Object
force JSON columns for MariaDB ##
28 |
# File 'app/models/maglev/site.rb', line 28 attribute :style, :json |
#translate_in(locale, source_locale) ⇒ Object
51 52 53 |
# File 'app/models/maglev/site.rb', line 51 def translate_in(locale, source_locale) translate_attr_in(:sections, locale, source_locale) end |