diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-02-13 19:59:08 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-13 19:59:08 +0300 |
commit | a4b843e9b844ed4e3a5f204e3fb5f43c68fd2db8 (patch) | |
tree | f64e5776bd2a2358804985f5e5842763183eef86 | |
parent | e5d9f4a3744acaa035809176b78bed8d81802130 (diff) |
Refactor outer anonymous function into a do block
-rw-r--r-- | app/validators/variable_duplicates_validator.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/validators/variable_duplicates_validator.rb b/app/validators/variable_duplicates_validator.rb index a5fa42aea24..7887b217829 100644 --- a/app/validators/variable_duplicates_validator.rb +++ b/app/validators/variable_duplicates_validator.rb @@ -6,7 +6,9 @@ class VariableDuplicatesValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if options[:scope] - scoped = value.group_by { |variable| Array(options[:scope]).map { |attr| variable.send(attr) } } # rubocop:disable GitlabSecurity/PublicSend + scoped = value.group_by do |variable| + Array(options[:scope]).map { |attr| variable.send(attr) } # rubocop:disable GitlabSecurity/PublicSend + end scoped.each_value { |scope| validate_duplicates(record, attribute, scope) } else validate_duplicates(record, attribute, value) |