Refactor variable duplicates error message

This commit is contained in:
Matija Čupić 2018-02-14 20:26:54 +01:00
parent 9a5ba5c674
commit 48db60e479
No known key found for this signature in database
GPG Key ID: 4BAF84FFACD2E5DE
1 changed files with 1 additions and 1 deletions

View File

@ -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