Rails4 compatibility of Setting model

git-svn-id: http://svn.redmine.org/redmine/trunk@12423 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2013-12-20 11:54:23 +00:00
parent 9b5ce4b7b4
commit 3e4d4a0c1a
1 changed files with 3 additions and 2 deletions

View File

@ -242,9 +242,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 = where(:name => name).first
unless setting
setting = new(:name => name)
setting = new
setting.name = name
setting.value = @@available_settings[name]['default']
end
setting