Class: Gitlab::Config::Entry::Validators::MutuallyExclusiveKeysValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Gitlab::Config::Entry::Validators::MutuallyExclusiveKeysValidator
- Defined in:
- lib/gitlab/config/entry/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/gitlab/config/entry/validators.rb', line 43 def validate_each(record, attribute, value) mutually_exclusive_keys = value.try(:keys).to_a & [:in] if mutually_exclusive_keys.length > 1 record.errors.add(attribute, "please use only one the following keys: " + mutually_exclusive_keys.join(', ')) end end |