Sha256: c7a037923ec32d142132098b34eebd7e4712777fae79bd3f3128dc61111953e2
Contents?: true
Size: 490 Bytes
Versions: 11
Compression:
Stored size: 490 Bytes
Contents
module Grape module Validations class AllowBlankValidator < Base def validate_param!(attr_name, params) return if (options_key?(:value) ? @option[:value] : @option) || !params.is_a?(Hash) value = params[attr_name] value = value.strip if value.respond_to?(:strip) return if value == false || value.present? raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: message(:blank) end end end end
Version data entries
11 entries across 11 versions & 2 rubygems