From 9607fcb5a9cdc7595633336881cc0dd8aa9fb8ca Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Fri, 14 Apr 2023 20:52:50 -0600 Subject: Corrige errores de OrdersController --- app/models/order.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/models/order.rb') diff --git a/app/models/order.rb b/app/models/order.rb index 213bde9..519de09 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -4,8 +4,12 @@ # public_id: string class Order < ApplicationRecord belongs_to :user_account - has_one :payment - has_many :product_orders + has_one :payment, dependent: :destroy + has_many :product_orders, dependent: :destroy has_many :products, through: :product_orders accepts_nested_attributes_for :product_orders + + def to_param + public_id + end end -- cgit v1.2.3