LETTERLIJK 1 LIJN
This commit is contained in:
parent
a88dd7d4c0
commit
18ea5ad627
1 changed files with 1 additions and 3 deletions
|
@ -13,9 +13,7 @@ class OrderItem < ActiveRecord::Base
|
|||
belongs_to :product
|
||||
|
||||
validates :product, presence: true
|
||||
validates :count, presence: true, numericality: { only_integer: true,
|
||||
less_than_or_equal_to: ->(oi) { oi.product.try(:stock) || 100 },
|
||||
greater_than_or_equal_to: 0 }
|
||||
validates :count, presence: true, numericality: { only_integer: true }
|
||||
|
||||
before_destroy :put_back_in_stock!
|
||||
after_create :remove_from_stock!
|
||||
|
|
Loading…
Reference in a new issue