Allow to have equal article and stockarticle.

* Modified validation to allow the same name.
This commit is contained in:
Benjamin Meichsner 2009-10-12 14:42:31 +02:00
parent c3ca3e23f9
commit 42d85c63be

View file

@ -42,7 +42,7 @@ class Article < ActiveRecord::Base
validates_length_of :unit, :in => 2..15 validates_length_of :unit, :in => 2..15
validates_numericality_of :price, :unit_quantity, :greater_than => 0 validates_numericality_of :price, :unit_quantity, :greater_than => 0
validates_numericality_of :deposit, :tax validates_numericality_of :deposit, :tax
validates_uniqueness_of :name, :scope => [:supplier_id, :deleted_at] validates_uniqueness_of :name, :scope => [:supplier_id, :deleted_at, :type]
# Callbacks # Callbacks
before_save :update_price_history before_save :update_price_history