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:
@@ -13,7 +13,7 @@ class Unit < ApplicationRecord
|
||||
length: {maximum: columns_hash['symbol'].limit}
|
||||
validates :description, length: {maximum: columns_hash['description'].limit}
|
||||
validates :multiplier, numericality: {equal_to: 1}, unless: :base
|
||||
validates :multiplier, numericality: {other_than: 0}, if: :base
|
||||
validates :multiplier, numericality: {other_than: 0, precision: true, scale: true}, if: :base
|
||||
|
||||
scope :defaults, ->{ where(user: nil) }
|
||||
scope :defaults_diff, ->{
|
||||
|
||||
Reference in New Issue
Block a user