Class: SiteSettings::Setting

Inherits:
ApplicationRecord show all
Defined in:
app/models/site_settings/setting.rb

Class Method Summary collapse

Class Method Details

.get(key) ⇒ Object



6
7
8
# File 'app/models/site_settings/setting.rb', line 6

def self.get(key)
  find_by(key: key)&.value
end

.set(key, value) ⇒ Object



10
11
12
13
# File 'app/models/site_settings/setting.rb', line 10

def self.set(key, value)
  setting = find_or_initialize_by(key: key)
  setting.update(value: value)
end