From 48db60e47987a3a7c08856423daf7713eb256e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Wed, 14 Feb 2018 20:26:54 +0100 Subject: [PATCH] Refactor variable duplicates error message --- app/validators/variable_duplicates_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/validators/variable_duplicates_validator.rb b/app/validators/variable_duplicates_validator.rb index ae9ebdf28cf..37e0a476399 100644 --- a/app/validators/variable_duplicates_validator.rb +++ b/app/validators/variable_duplicates_validator.rb @@ -21,7 +21,7 @@ class VariableDuplicatesValidator < ActiveModel::EachValidator duplicates = values.reject(&:marked_for_destruction?).group_by(&:key).select { |_, v| v.many? }.map(&:first) if duplicates.any? error_message = "has duplicate variables (#{duplicates.join(", ")})" - error_message += " in #{options[:scope]} scope" if options[:scope] + error_message += " for #{values.first.send(options[:scope])} scope" if options[:scope] # rubocop:disable GitlabSecurity/PublicSend record.errors.add(attribute, error_message) end end