]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4959 Use correct attribute to validate text
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 31 Jan 2014 09:11:24 +0000 (10:11 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 31 Jan 2014 09:11:30 +0000 (10:11 +0100)
sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb

index 03a9862d3f1ea6588133d8717e1921acaf40db2f..cf0f6578eb9fd5d00b044f5fe17c7729141dd3ab 100644 (file)
@@ -19,7 +19,7 @@
 #
 class ManualMeasure < ActiveRecord::Base
   include ActionView::Helpers::NumberHelper
-  
+
   belongs_to :resource, :class_name => 'Project'
   validates_uniqueness_of :metric_id, :scope => :resource_id
   validates_length_of :text_value, :maximum => 4000, :allow_nil => true, :allow_blank => true
@@ -137,7 +137,7 @@ class ManualMeasure < ActiveRecord::Base
           write_attribute("value", Sonar::RulePriority.id(raw_value))
           write_attribute("text_value", raw_value)
         when Metric::VALUE_TYPE_STRING
-          errors.add('value', "A text value must be provided") if value_before_type_cast.nil? || value_before_type_cast == ''
+          errors.add('value', "A text value must be provided") if text_value.nil? || text_value == ''
       end
     end
   end