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
methods ##.
- #find_section(type) ⇒ Object
-
#name ⇒ Object
validations ##.
-
#sections ⇒ Object
translations ##.
-
#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
#find_sections_by_type, #prepare_sections, #prepare_sections_translations
Methods included from LocalesConcern
#add_locale, #default_locale, #default_locale_prefix, #each_locale, #locale_prefixes
Methods inherited from ApplicationRecord
Instance Method Details
#api_attributes ⇒ Object
methods ##
34 35 36 |
# File 'app/models/maglev/site.rb', line 34 def api_attributes i[id name] end |
#find_section(type) ⇒ Object
38 39 40 |
# File 'app/models/maglev/site.rb', line 38 def find_section(type) sections&.find { |section| section['type'] == type } end |
#name ⇒ Object
validations ##
31 |
# File 'app/models/maglev/site.rb', line 31 validates :name, presence: true |
#sections ⇒ Object
translations ##
28 |
# File 'app/models/maglev/site.rb', line 28 translates :sections |
#style ⇒ Object
force JSON columns for MariaDB ##
24 |
# File 'app/models/maglev/site.rb', line 24 attribute :style, :json |
#translate_in(locale, source_locale) ⇒ Object
42 43 44 |
# File 'app/models/maglev/site.rb', line 42 def translate_in(locale, source_locale) translate_attr_in(:sections, locale, source_locale) end |