summaryrefslogtreecommitdiffstats
path: root/app/models/custom_field.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/custom_field.rb')
-rw-r--r--app/models/custom_field.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 75fac2464..c5c8a9373 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -80,7 +80,7 @@ class CustomField < ActiveRecord::Base
when 'bool'
[[l(:general_text_Yes), '1'], [l(:general_text_No), '0']]
else
- read_possible_values_utf8_encoded || []
+ possible_values || []
end
end
@@ -91,14 +91,20 @@ class CustomField < ActiveRecord::Base
when 'bool'
['1', '0']
else
- read_possible_values_utf8_encoded
+ values = super()
+ if values.is_a?(Array)
+ values.each do |value|
+ value.force_encoding('UTF-8') if value.respond_to?(:force_encoding)
+ end
+ end
+ values
end
end
# Makes possible_values accept a multiline string
def possible_values=(arg)
if arg.is_a?(Array)
- write_attribute(:possible_values, arg.compact.collect(&:strip).select {|v| !v.blank?})
+ super(arg.compact.collect(&:strip).select {|v| !v.blank?})
else
self.possible_values = arg.to_s.split(/[\n\r]+/)
end
@@ -218,14 +224,4 @@ class CustomField < ActiveRecord::Base
end
errs
end
-
- def read_possible_values_utf8_encoded
- 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)
- end
- end
- values
- end
end