From 64214e370778dc3efdaca85acd0cd7a569a79b81 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Thu, 30 Mar 2023 18:17:38 -0600 Subject: AƱade validadores de product_review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/product_review.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/product_review.rb b/app/models/product_review.rb index 49e344c..ceade9a 100644 --- a/app/models/product_review.rb +++ b/app/models/product_review.rb @@ -1,4 +1,12 @@ +# frozen_string_literal: true + +# ProductReview +# review: text +# rating: integer class ProductReview < ApplicationRecord belongs_to :user_account belongs_to :product + + validates :review, presence: true + validates :rating, presence: true, inclusion: { in: 1..5 } end -- cgit v1.2.3