16319.patch

Felix Schäfer, 2014-03-11 15:56

Download (884 Bytes)

View differences:

app/models/custom_field.rb
114 114
  end
115 115

  
116 116
  def possible_values
117
    values = super()
117
    values = read_attribute(:possible_values)
118 118
    if values.is_a?(Array)
119 119
      values.each do |value|
120 120
        value.force_encoding('UTF-8') if value.respond_to?(:force_encoding)
......
128 128
  # Makes possible_values accept a multiline string
129 129
  def possible_values=(arg)
130 130
    if arg.is_a?(Array)
131
      super(arg.compact.collect(&:strip).select {|v| !v.blank?})
131
      values = arg.compact.collect(&:strip).select {|v| !v.blank?}
132
      write_attribute(:possible_values, values)
132 133
    else
133 134
      self.possible_values = arg.to_s.split(/[\n\r]+/)
134 135
    end