Class: API::Validations::Validators::Absence

Inherits:
Grape::Validations::Base
  • Object
show all
Defined in:
lib/api/validations/validators/absence.rb

Instance Method Summary collapse

Instance Method Details

#validate_param!(attr_name, params) ⇒ Object

Raises:

  • (Grape::Exceptions::Validation)

7
8
9
10
11
# File 'lib/api/validations/validators/absence.rb', line 7

def validate_param!(attr_name, params)
  return if params.respond_to?(:key?) && !params.key?(attr_name)

  raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: message(:absence)
end