From 26b40a7a38ced56998a4316ac0d21374c6080d6b Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Tue, 14 Mar 2023 20:18:28 -0600 Subject: AƱade spec de Product MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/product.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models') diff --git a/app/models/product.rb b/app/models/product.rb index d12cd41..72d7f33 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -11,6 +11,14 @@ class Product < ApplicationRecord belongs_to :company + validates :name, presence: true + validates :unitary_price, presence: true + validates :unitary_price, comparison: { greater_than: 0 } + validates :bulk_price, presence: true + validates :bulk_price, comparison: { greater_than: 0 } + validates :available_quantity, presence: true + validates :available_quantity, comparison: { greater_than: 0 } + has_one_attached :picture serialize :categories, Array -- cgit v1.2.3