Don't let users generate money
This commit is contained in:
parent
13d0f27c7e
commit
5f73efc7d4
1 changed files with 2 additions and 1 deletions
|
@ -13,7 +13,8 @@ class OrderItem < ActiveRecord::Base
|
|||
belongs_to :product
|
||||
|
||||
validates :product, presence: true
|
||||
validates :count, presence: true, numericality: { only_integer: true }
|
||||
validates :count, presence: true, numericality: { only_integer: true,
|
||||
greater_than_or_equal_to: 0 }
|
||||
|
||||
before_destroy :put_back_in_stock!
|
||||
after_create :remove_from_stock!
|
||||
|
|
Loading…
Reference in a new issue