add the 'more_then' validator to the params validator

This commit is contained in:
Alex Turchyn
2024-01-25 01:36:50 +02:00
parent d1070c4955
commit 00abad56cb
+8
View File
@@ -110,5 +110,13 @@ module Params
raise_error(message || "#{key} must be one of #{values.join(', ')}")
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