Class: Econfig::ActiveRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/econfig/active_record.rb

Defined Under Namespace

Classes: Option

Instance Method Summary collapse

Instance Method Details

#get(key) ⇒ Object



10
11
12
# File 'lib/econfig/active_record.rb', line 10

def get(key)
  Option.find_by_key(key).try(:value)
end

#set(key, value) ⇒ Object



14
15
16
17
# File 'lib/econfig/active_record.rb', line 14

def set(key, value)
  option = Option.where(:key => key).first_or_initialize
  option.update_attributes!(:value => value)
end