1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00
fab-manager/app/models/order_item.rb

11 lines
331 B
Ruby
Raw Permalink Normal View History

2022-08-19 19:59:13 +02:00
# frozen_string_literal: true
# A single line inside an Order. Can be an article of Order
class OrderItem < ApplicationRecord
belongs_to :order
belongs_to :orderable, polymorphic: true
2023-02-24 17:26:55 +01:00
belongs_to :product, foreign_key: 'orderable_id', inverse_of: :order_items
2022-08-19 19:59:13 +02:00
validates :orderable, :order_id, :amount, presence: true
end