Fixed: Oracle error when saving serialized setting (eg. mail notifications)

git-svn-id: http://redmine.rubyforge.org/svn/trunk@742 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-09-18 17:50:17 +00:00
parent eb371db5b9
commit 25012efc9c
2 changed files with 11 additions and 0 deletions

View File

@ -35,6 +35,11 @@ class Setting < ActiveRecord::Base
v
end
def value=(v)
v = v.to_yaml if @@available_settings[name]['serialized'] && v.is_a?(String)
write_attribute(:value, v)
end
# Returns the value of the setting named name
def self.[](name)
v = @cached_settings[name]

View File

@ -36,4 +36,10 @@ class SettingTest < Test::Unit::TestCase
# make sure db has been updated (UPDATE)
assert_equal "My other title", Setting.find_by_name('app_title').value
end
def test_serialized_setting
Setting.notified_events = ['issue_added', 'issue_updated', 'news_added']
assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.notified_events
assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.find_by_name('notified_events').value
end
end