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:
parent
877a55a614
commit
b308442b3c
1 changed files with 1 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue