add the 'more_then' validator to the params validator
This commit is contained in:
@@ -110,5 +110,13 @@ module Params
|
|||||||
|
|
||||||
raise_error(message || "#{key} must be one of #{values.join(', ')}")
|
raise_error(message || "#{key} must be one of #{values.join(', ')}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def more_than(params, key, value, message: nil)
|
||||||
|
return if params.blank?
|
||||||
|
return if params[key].blank?
|
||||||
|
return if params[key].to_f > value
|
||||||
|
|
||||||
|
raise_error(message || "#{key} must be more than #{value}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user