Class: Cdx::Setting

Inherits:
ApplicationRecord show all
Includes:
SeoSupport
Defined in:
app/models/cdx/setting.rb

Constant Summary collapse

AVAILABLE_THEMES =

Constants

%w(black-light black blue-light blue green-light green purple-light purple red-light red yellow-light yellow).freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttachmentMacros

#has_many_attached, #has_one_attached

Class Method Details

.currentObject



23
24
25
# File 'app/models/cdx/setting.rb', line 23

def self.current
  Setting.first_or_create(acronym: 'CDX', default_theme: AVAILABLE_THEMES.last, default_locale: 'en', available_locales: Cdx.available_locales)
end

Instance Method Details

#acronym=(value) ⇒ Object

Methods



15
16
17
# File 'app/models/cdx/setting.rb', line 15

def acronym=(value)
  super(value.upcase)
end

#available_localesObject



19
20
21
# File 'app/models/cdx/setting.rb', line 19

def available_locales
  (super << default_locale).uniq
end