Hello, I saw an issue on Github talking about ActiveModel validators Numercality validator only_integer is not reliable with decimal storage.
The validator’ default behaviour is checking the input with regular expression (/\A[±]?\d+\z/) to see if input matches an integer’s format.
If the input is like “15.0”, this validation would fail.
But in some cases, you can only get “15.0”, “15.00”. For example, in a database storing all numbers using decimal(10,2).
Should “15.0” or “15.00” be recognized as an integer? Or people would have to check it manually?
As for the performance, I did a benchmark here: precise_integer_validator_benchmark. A-million-times BigDecimal validation is about 2 seconds slower than RegEx validation on my MacBook Air. (2.6 vs 0.7), is it acceptable?