Merged r12968 (#16319).

git-svn-id: http://svn.redmine.org/redmine/branches/2.5-stable@13024 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-03-29 14:38:47 +00:00
parent 33a7f6bc11
commit 2344dfe7f7
1 changed files with 3 additions and 2 deletions

View File

@ -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