From d7729d6d4f3acc81e3adc87a2d22557ff5e21d9c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 15 Mar 2014 10:25:24 +0000 Subject: [PATCH] Use #read/#write_attribute instead of #super when overwriting default accessors (#16319). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@12968 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/custom_field.rb | 5 +++-- 1 file 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