Sha256: 032a7f6b28a2c33b9ff08c2601216a7055dc56f6aa713b280ab50562bef19206
Contents?: true
Size: 508 Bytes
Versions: 1
Compression:
Stored size: 508 Bytes
Contents
module Econfig class ActiveRecord class Option < ::ActiveRecord::Base attr_accessible :key, :value self.table_name = "econfig_options" validates_uniqueness_of :key validates_presence_of :key end def get(key) Option.find_by_key(key).try(:value) end def set(key, value) option = Option.where(:key => key).first_or_initialize option.update_attributes!(:value => value) end private def options @options ||= {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
econfig-0.1.0 | lib/econfig/active_record.rb |