Skip to content
Snippets Groups Projects
Verified Commit 48db60e4 authored by Matija Čupić's avatar Matija Čupić
Browse files

Refactor variable duplicates error message

parent 9a5ba5c6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment