lib/grape/validations/validators/presence.rb in grape-0.13.0 vs lib/grape/validations/validators/presence.rb in grape-0.14.0
- old
+ new
@@ -5,12 +5,11 @@
return unless @scope.should_validate?(params)
super
end
def validate_param!(attr_name, params)
- unless params.respond_to?(:key?) && params.key?(attr_name)
- fail Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message_key: :presence
- end
+ return if params.respond_to?(:key?) && params.key?(attr_name)
+ fail Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message_key: :presence
end
end
end
end