Sha256: 9544abeadd57f19baaa9f24c4d1e4d00df6ea16bab10f46f75e7a43f80948ec8

Contents?: true

Size: 324 Bytes

Versions: 17

Compression:

Stored size: 324 Bytes

Contents

module Grape
  module Validations
    class PresenceValidator < Base
      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(:presence)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.2.5/lib/grape/validations/validators/presence.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/grape-1.2.5/lib/grape/validations/validators/presence.rb
grape-1.2.5 lib/grape/validations/validators/presence.rb
grape-1.2.4 lib/grape/validations/validators/presence.rb
grape-1.2.3 lib/grape/validations/validators/presence.rb
grape-1.2.2 lib/grape/validations/validators/presence.rb
grape-1.2.1 lib/grape/validations/validators/presence.rb
grape-1.2.0 lib/grape/validations/validators/presence.rb
grape-1.1.0 lib/grape/validations/validators/presence.rb
grape-1.0.3 lib/grape/validations/validators/presence.rb
grape-1.0.2 lib/grape/validations/validators/presence.rb
grape-1.0.1 lib/grape/validations/validators/presence.rb
grape-1.0.0 lib/grape/validations/validators/presence.rb
grape-0.19.2 lib/grape/validations/validators/presence.rb
grape-0.19.1 lib/grape/validations/validators/presence.rb
grape-0.19.0 lib/grape/validations/validators/presence.rb
grape-0.18.0 lib/grape/validations/validators/presence.rb