Skip to content

Commit

Permalink
Rails4 compatibility of Setting model
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.redmine.org/redmine/trunk@12423 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information
marutosi committed Dec 20, 2013
1 parent 9b5ce4b commit 3e4d4a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,10 @@ def self.clear_cache
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
Expand Down

0 comments on commit 3e4d4a0

Please sign in to comment.