Also validate article price attributes.

Fixed adding articles with unit_quantity = 0, what causes an error in ordering page. Fixed #86
This commit is contained in:
Benjamin Meichsner 2013-02-24 19:59:29 +01:00
parent 877a55a614
commit b308442b3c

View file

@ -4,6 +4,7 @@ class ArticlePrice < ActiveRecord::Base
has_many :order_articles has_many :order_articles
validates_presence_of :price, :tax, :deposit, :unit_quantity validates_presence_of :price, :tax, :deposit, :unit_quantity
validates_numericality_of :price, :unit_quantity, :greater_than => 0
# Custom attribute setter that accepts decimal numbers using localized decimal separator. # Custom attribute setter that accepts decimal numbers using localized decimal separator.
def price=(price) def price=(price)