Commit 61e46469 authored by Matija Čupić's avatar Matija Čupić

Refactor variable duplicates error message

parent 238cf72e
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment