Closed cyprusad closed 9 years ago
I would love to see support for 0
as a number, because it's a special case where a unit doesn't matter.
validates :length, measured: { greater_than: 0 }
You can do that in a separate PR though.
I am thinking I'll deal with the 0
case as well as a special check for FixNum
both in a separate PR.
Great
@Shopify/shipping
Adds numericality validations on the
measured
fields to support numerical comparisons like<, ==, >, <=, >=
as you'd expect. We can now validatemeasured
fields in the model to be within certain pre-set bounds. Differences in units while doing bound validation checks also works. You can also set custom validation error messages for failing validations.For example, you can set a
measured
field calledlength
in your model and create validations for it like,Validating against non-Measured fields raises an error. You can also pass
Proc
s while valdiating