Class: Grape::Validations::PresenceValidator
Instance Attribute Summary
Attributes inherited from Validator
#attrs
Instance Method Summary
collapse
Methods inherited from Validator
inherited, #initialize
Instance Method Details
#validate!(params) ⇒ Object
4
5
6
7
|
# File 'lib/grape/validations/presence.rb', line 4
def validate!(params)
return unless @scope.should_validate?(params)
super
end
|
#validate_param!(attr_name, params) ⇒ Object
9
10
11
12
13
|
# File 'lib/grape/validations/presence.rb', line 9
def validate_param!(attr_name, params)
unless params.has_key?(attr_name)
raise Grape::Exceptions::Validation, param: @scope.full_name(attr_name), message_key: :presence
end
end
|