summaryrefslogtreecommitdiffstats
path: root/app/models/setting.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 15:30:46 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 15:30:46 +0000
commit23264ec3eb8e17543922a0093ed402a9d7ba5de9 (patch)
tree94817aaa5e78fe305732196d5c4ed79602a2ea78 /app/models/setting.rb
parent1fa1f620183d2268e906deadb1c5f87a0335d518 (diff)
downloadredmine-23264ec3eb8e17543922a0093ed402a9d7ba5de9.tar.gz
redmine-23264ec3eb8e17543922a0093ed402a9d7ba5de9.zip
Mail notification options restored (default is: issue_added and issue_updated).
Added mail notification when adding a news (disabled by default). git-svn-id: http://redmine.rubyforge.org/svn/trunk@728 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/setting.rb')
-rw-r--r--app/models/setting.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/app/models/setting.rb b/app/models/setting.rb
index c09b4bdb3..d4c82191a 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -27,16 +27,23 @@ class Setting < ActiveRecord::Base
# Hash used to cache setting values
@cached_settings = {}
@cached_cleared_on = Time.now
-
+
+ def value
+ v = read_attribute(:value)
+ # Unserialize serialized settings
+ v = YAML::load(v) if @@available_settings[name]['serialized'] && v.is_a?(String)
+ v
+ end
+
# Returns the value of the setting named name
def self.[](name)
- value = @cached_settings[name]
- value ? value : (@cached_settings[name] = find_or_default(name).value)
+ v = @cached_settings[name]
+ v ? v : (@cached_settings[name] = find_or_default(name).value)
end
- def self.[]=(name, value)
+ def self.[]=(name, v)
setting = find_or_default(name)
- setting.value = (value ? value.to_s : "")
+ setting.value = (v ? v : "")
@cached_settings[name] = nil
setting.save
setting.value