Class: SiriusApi::Validators::Min

Inherits:
Grape::Validations::SingleOptionValidator
  • Object
show all
Defined in:
lib/sirius_api/validators/min.rb

Instance Method Summary collapse

Instance Method Details

#validate_param!(attr_name, params) ⇒ Object


6
7
8
9
10
# File 'lib/sirius_api/validators/min.rb', line 6

def validate_param!(attr_name, params)
  unless params[attr_name].to_i >= @option
    raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: "must be at least #{@option}"
  end
end