From bea036dc52202f83dcfcb1ecb0cf37dd5516c391 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Sat, 13 Jun 2020 18:48:19 +0200 Subject: [PATCH] Updated quantity name ambiguoty check on creation --- app/models/quantity.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/quantity.rb b/app/models/quantity.rb index 757c999..e6222d4 100644 --- a/app/models/quantity.rb +++ b/app/models/quantity.rb @@ -25,7 +25,7 @@ class Quantity < ActiveRecord::Base # Formula ambiguity vlidation delayed after save, as otherwise there seems to # be no other way to validate against newly changed :name after_save do - next unless name_changed? + next unless name_changed? || changes.empty? formulas = project.formulas.where('formulas.code LIKE ?', "%#{name}%").includes(:quantity) next unless formulas.exists?