[#935] Setting improperly set up for default values

having a fixed call order resolves a problem where
'value=' was called before 'name=' resulting in no
serialization
This commit is contained in:
Romano Licker 2012-03-15 11:55:37 +01:00 committed by Gregor Schmidt
parent 9fde11f950
commit 1e96ac9e06
1 changed files with 4 additions and 2 deletions

View File

@ -185,8 +185,10 @@ private
def self.find_or_default(name)
name = name.to_s
raise "There's no setting named #{name}" unless @@available_settings.has_key?(name)
setting = find_by_name(name)
setting ||= new(:name => name, :value => @@available_settings[name]['default']) if @@available_settings.has_key? name
find_by_name(name) or new do |s|
s.name = name
s.value = @@available_settings[name]['default']
end
end
def self.cache_key(name)