Class: Grape::Validations::AtLeastOneOfValidator
- Defined in:
- lib/grape/validations/at_least_one_of.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Attributes inherited from Validator
Instance Method Summary collapse
Methods inherited from Validator
convert_to_short_name, inherited, #initialize
Constructor Details
This class inherits a constructor from Grape::Validations::Validator
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/grape/validations/at_least_one_of.rb', line 4 def params @params end |
Instance Method Details
#validate!(params) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/grape/validations/at_least_one_of.rb', line 6 def validate!(params) @params = params if no_exclusive_params_are_present raise Grape::Exceptions::Validation, params: attrs.map(&:to_s), message_key: :at_least_one end params end |