class AppConfig < ActiveRecord::Base after_save :reload validates :name, :presence=>true def self.[](name) val = select{|t| t.name==name}[0].try(:value) if val && (val==val.to_i.to_s) val = val.to_i end val end def self.current @current ||= AppConfig.all end def self.reload @current = nil end end