Refactor variable duplicates error message
This commit is contained in:
parent
9a5ba5c674
commit
48db60e479
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue