Show More
Commit Description:
[web] fix time.new, time.now to use gmtime...
Commit Description:
[web] fix time.new, time.now to use gmtime git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@249 6386c4cd-e34a-4fa8-8920-d93eb39b512e
File last commit:
Show/Diff file:
Action:
app/models/configuration.rb | 43 lines | 725 B | text/x-ruby | RubyLexer |
jittat
[web] added configurations...
r76 class Configuration < ActiveRecord::Base
@@configurations = nil
def self.get(key)
if @@configurations == nil
self.read_config
end
return @@configurations[key]
end
def self.[](key)
self.get(key)
end
def self.reload
self.read_config
end
def self.clear
@@configurations = nil
end
protected
def self.read_config
@@configurations = {}
Configuration.find(:all).each do |conf|
key = conf.key
val = conf.value
case conf.value_type
when 'string'
@@configurations[key] = val
when 'integer'
@@configurations[key] = val.to_i
when 'boolean'
@@configurations[key] = (val=='true')
end
end
end
end