allow 1 char unit, eg L or g

This commit is contained in:
Tom Carchrae 2019-03-23 03:24:15 -07:00 committed by wvengen
parent 1f71501dc1
commit d70c3a9bf1

View file

@ -56,7 +56,7 @@ class Article < ApplicationRecord
# Validations # Validations
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category
validates_length_of :name, :in => 4..60 validates_length_of :name, :in => 4..60
validates_length_of :unit, :in => 2..15 validates_length_of :unit, :in => 1..15
validates_numericality_of :price, :greater_than_or_equal_to => 0 validates_numericality_of :price, :greater_than_or_equal_to => 0
validates_numericality_of :unit_quantity, :greater_than => 0 validates_numericality_of :unit_quantity, :greater_than => 0
validates_numericality_of :deposit, :tax validates_numericality_of :deposit, :tax