Class: ParamsChecker::ParamChecker::FileChecker
Instance Attribute Summary
#key, #params, #schema
Instance Method Summary
collapse
#add_field_error, #initialize
Instance Method Details
#call ⇒ Object
313
314
315
316
317
|
# File 'lib/params_checker/param_checker.rb', line 313
def call
return nil if schema[key][:allow_nil] && params[key].nil?
check_type && params[key]
end
|
#check_type ⇒ Object
319
320
321
322
323
|
# File 'lib/params_checker/param_checker.rb', line 319
def check_type
valid = params[key].is_a?(ActionDispatch::Http::UploadedFile)
add_field_error("This field's type must be file.") unless valid
valid
end
|