diff app/models/custom_field_value.rb @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents e248c7af89ec
children
line wrap: on
line diff
--- a/app/models/custom_field_value.rb	Tue Sep 09 09:28:31 2014 +0100
+++ b/app/models/custom_field_value.rb	Tue Sep 09 09:29:00 2014 +0100
@@ -16,7 +16,13 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 class CustomFieldValue
-  attr_accessor :custom_field, :customized, :value
+  attr_accessor :custom_field, :customized, :value, :value_was
+
+  def initialize(attributes={})
+    attributes.each do |name, v|
+      send "#{name}=", v
+    end
+  end
 
   def custom_field_id
     custom_field.id
@@ -43,7 +49,7 @@
   end
 
   def validate_value
-    custom_field.validate_field_value(value).each do |message|
+    custom_field.validate_custom_value(self).each do |message|
       customized.errors.add(:base, custom_field.name + ' ' + message)
     end
   end