diff options
author | HombreLaser <sebastian-440@live.com> | 2023-04-01 13:07:39 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-04-01 13:07:39 -0600 |
commit | d8842d83862fc26de22b3a6ed0a89e56f87b2e7e (patch) | |
tree | 00f1c4e2c38d3de97e418ddaf1227ebb0f176677 /app/models | |
parent | bd3a6121c068f871dc5bd40c79c052e33fcd330e (diff) |
Añade controlador de Reviews
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/product.rb | 2 | ||||
-rw-r--r-- | app/models/user_account.rb | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/app/models/product.rb b/app/models/product.rb index e6f3720..b9ca828 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -11,6 +11,8 @@ class Product < ApplicationRecord belongs_to :company + has_many :product_reviews + validates :name, presence: true validates :unitary_price, presence: true validates :unitary_price, comparison: { greater_than: 0 } diff --git a/app/models/user_account.rb b/app/models/user_account.rb index 23f7c5b..0fe5c3d 100644 --- a/app/models/user_account.rb +++ b/app/models/user_account.rb @@ -11,6 +11,7 @@ class UserAccount < ApplicationRecord has_many :user_account_addresses, dependent: :destroy has_many :addresses, through: :user_account_addresses has_many :cards, dependent: :destroy + has_many :product_reviews validates :email, presence: true validates :email, uniqueness: true |