summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-15 10:25:24 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-15 10:25:24 +0000
commitd7729d6d4f3acc81e3adc87a2d22557ff5e21d9c (patch)
treef0375cd5f0fac49cc908deefaaa496a4617b3b00
parent15471196273907bdbfaad9859011bef29b27aac2 (diff)
downloadredmine-d7729d6d4f3acc81e3adc87a2d22557ff5e21d9c.tar.gz
redmine-d7729d6d4f3acc81e3adc87a2d22557ff5e21d9c.zip
Use #read/#write_attribute instead of #super when overwriting default accessors (#16319).
Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@12968 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/custom_field.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index a99c15d2a..48ef2c7cc 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -114,7 +114,7 @@ class CustomField < ActiveRecord::Base
end
def possible_values
- values = super()
+ values = read_attribute(:possible_values)
if values.is_a?(Array)
values.each do |value|
value.force_encoding('UTF-8') if value.respond_to?(:force_encoding)
@@ -128,7 +128,8 @@ class CustomField < ActiveRecord::Base
# Makes possible_values accept a multiline string
def possible_values=(arg)
if arg.is_a?(Array)
- super(arg.compact.collect(&:strip).select {|v| !v.blank?})
+ values = arg.compact.collect(&:strip).select {|v| !v.blank?}
+ write_attribute(:possible_values, values)
else
self.possible_values = arg.to_s.split(/[\n\r]+/)
end