From 0c78c0dacd8aaa0b0bf8b2688b068e1e1b2b32cf Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Fri, 31 Jan 2014 10:11:24 +0100 Subject: [PATCH] SONAR-4959 Use correct attribute to validate text --- .../src/main/webapp/WEB-INF/app/models/manual_measure.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb index 03a9862d3f1..cf0f6578eb9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb @@ -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 -- 2.39.5