Class: Geostats::Setting

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/geostats/models/setting.rb

Class Method Summary collapse

Class Method Details

.get(key) ⇒ Object



5
6
7
8
# File 'lib/geostats/models/setting.rb', line 5

def self.get(key)
  setting = where(:key => key.to_s).first
  setting ? setting.value : nil
end

.set(key, value) ⇒ Object



10
11
12
13
14
# File 'lib/geostats/models/setting.rb', line 10

def self.set(key, value)
  setting = where(:key => key.to_s).first || new(:key => key.to_s)
  setting.update_attribute(:value, value)
  setting
end