forked from fixin.me/fixin.me
Extend NumericalityValidator to check precision and scale
Use new checks on Unit.multiplier Closes #28
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
require 'core_ext/big_decimal_scientific_notation'
|
||||
|
||||
ActiveSupport.on_load :active_record do
|
||||
ActiveModel::Validations::NumericalityValidator.prepend CoreExt::ActiveModel::Validations::NumericalityValidatesPrecisionAndScale
|
||||
end
|
||||
|
||||
ActiveSupport.on_load :action_dispatch_system_test_case do
|
||||
prepend CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelperUniqueId
|
||||
end
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
en:
|
||||
errors:
|
||||
messages:
|
||||
precision_exceeded: must not exceed %{value} significant digits
|
||||
scale_exceeded: must not exceed %{value} decimal digits
|
||||
activerecord:
|
||||
attributes:
|
||||
unit:
|
||||
|
||||
Reference in New Issue
Block a user