1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) invalid tables names for cart items

This commit is contained in:
Sylvain 2023-02-03 12:49:17 +01:00 committed by Sylvain
parent 42e89ea1b0
commit 09897b7067
6 changed files with 11 additions and 7 deletions

View File

@ -6,6 +6,10 @@ require_relative 'cart_item'
class CartItem::BaseItem < ApplicationRecord
self.abstract_class = true
def self.table_name_prefix
'cart_item_'
end
def price
{ elements: {}, amount: 0 }
end

View File

@ -1,8 +1,4 @@
# frozen_string_literal: true
# Items that can be added to the shopping cart
module CartItem
def self.table_name_prefix
'cart_item_'
end
end
module CartItem; end

View File

@ -4,6 +4,8 @@ require_relative 'cart_item'
# A discount coupon applied to the whole shopping cart
class CartItem::Coupon < ApplicationRecord
self.table_name = 'cart_item_coupons'
belongs_to :operator_profile, class_name: 'InvoicingProfile'
belongs_to :customer_profile, class_name: 'InvoicingProfile'
belongs_to :coupon

View File

@ -4,6 +4,8 @@ require_relative 'cart_item'
# A relation table between a pending event reservation and a special price for this event
class CartItem::EventReservationTicket < ApplicationRecord
self.table_name = 'cart_item_event_reservation_tickets'
belongs_to :cart_item_event_reservation, class_name: 'CartItem::EventReservation', inverse_of: :cart_item_event_reservation_tickets
belongs_to :event_price_category, inverse_of: :cart_item_event_reservation_tickets
end

View File

@ -4,6 +4,8 @@ require_relative 'cart_item'
# A payment schedule applied to plan in the shopping cart
class CartItem::PaymentSchedule < ApplicationRecord
self.table_name = 'cart_item_payment_schedules'
belongs_to :customer_profile, class_name: 'InvoicingProfile'
belongs_to :coupon
belongs_to :plan

View File

@ -2,8 +2,6 @@
# A training reservation added to the shopping cart
class CartItem::TrainingReservation < CartItem::Reservation
self.table_name = 'cart_item_reservations'
has_many :cart_item_reservation_slots, class_name: 'CartItem::ReservationSlot', dependent: :destroy, inverse_of: :cart_item,
foreign_key: 'cart_item_id', foreign_type: 'cart_item_type'
accepts_nested_attributes_for :cart_item_reservation_slots