summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-03-30 18:17:38 -0600
committerHombreLaser <sebastian-440@live.com>2023-03-30 18:17:38 -0600
commit64214e370778dc3efdaca85acd0cd7a569a79b81 (patch)
tree395bddf59f5bb6d04a7f12b6cdbe7eb3443275aa
parent8ec919e91336a51c2a7af9922424bbcf6d7643fe (diff)
Añade validadores de product_review
-rw-r--r--app/models/product_review.rb8
1 files changed, 8 insertions, 0 deletions
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