Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgfyoung <gfyoung17@gmail.com>2018-06-27 19:20:23 +0300
committergfyoung <gfyoung17@gmail.com>2018-06-27 19:48:37 +0300
commit720ed6f6aba16ba1a7abab83cbd0c4758ff37155 (patch)
treea9b27498286f95169c571084e8e9e6a7ecd44e17 /app/validators/variable_duplicates_validator.rb
parentf63e234b57e07e2020f9698f48c9515905d4b6a3 (diff)
Enable frozen string in apps/validators/*.rb
Partially addresses #47424.
Diffstat (limited to 'app/validators/variable_duplicates_validator.rb')
-rw-r--r--app/validators/variable_duplicates_validator.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/validators/variable_duplicates_validator.rb b/app/validators/variable_duplicates_validator.rb
index 72660be6c43..90193e85f2a 100644
--- a/app/validators/variable_duplicates_validator.rb
+++ b/app/validators/variable_duplicates_validator.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# VariableDuplicatesValidator
#
# This validator is designed for especially the following condition
@@ -22,8 +24,8 @@ class VariableDuplicatesValidator < ActiveModel::EachValidator
def validate_duplicates(record, attribute, values)
duplicates = values.reject(&:marked_for_destruction?).group_by(&:key).select { |_, v| v.many? }.map(&:first)
if duplicates.any?
- error_message = "have duplicate values (#{duplicates.join(", ")})"
- error_message += " for #{values.first.send(options[:scope])} scope" if options[:scope] # rubocop:disable GitlabSecurity/PublicSend
+ error_message = +"have duplicate values (#{duplicates.join(", ")})"
+ error_message << " for #{values.first.send(options[:scope])} scope" if options[:scope] # rubocop:disable GitlabSecurity/PublicSend
record.errors.add(attribute, error_message)
end
end