diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-14 08:25:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-14 08:25:20 +0000 |
commit | 1aea5ccfd4e818a93f6340b01fd659409f8ec598 (patch) | |
tree | 433efdb93600c26bf0d293c323c2bc60967a9f72 /app/models | |
parent | 38daed8b4e571561451fabc6982d1c2c323aff3e (diff) | |
download | redmine-1aea5ccfd4e818a93f6340b01fd659409f8ec598.tar.gz redmine-1aea5ccfd4e818a93f6340b01fd659409f8ec598.zip |
CustomField#possible_values may raise undefined method `force_encoding' error (#19316).
git-svn-id: http://svn.redmine.org/redmine/trunk@14079 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/custom_field.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 02d183397..3fbb1edc2 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -118,7 +118,7 @@ class CustomField < ActiveRecord::Base values = read_attribute(:possible_values) if values.is_a?(Array) values.each do |value| - value.force_encoding('UTF-8') + value.to_s.force_encoding('UTF-8') end values else @@ -129,7 +129,7 @@ class CustomField < ActiveRecord::Base # Makes possible_values accept a multiline string def possible_values=(arg) if arg.is_a?(Array) - values = arg.compact.collect(&:strip).select {|v| !v.blank?} + values = arg.compact.map {|a| a.to_s.strip}.reject(&:blank?) write_attribute(:possible_values, values) else self.possible_values = arg.to_s.split(/[\n\r]+/) |