Add error on existing supplier name for current employee
This commit is contained in:
@@ -51,6 +51,6 @@ class NewSupplier
|
||||
def supplier_name_uniqueness
|
||||
return unless current_employee.present? and supplier_name.present?
|
||||
current_suppliers = current_employee.suppliers
|
||||
errors.add :base, 'You already have a supplier with that name' if current_suppliers.map(&:name).include? supplier_name
|
||||
errors.add :supplier_name, 'You already have a supplier with that name' if current_suppliers.map(&:name).include? supplier_name
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user