mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-04 15:24:23 +01:00
11 lines
331 B
Ruby
11 lines
331 B
Ruby
# 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
|
|
belongs_to :product, foreign_key: 'orderable_id', inverse_of: :order_items
|
|
|
|
validates :orderable, :order_id, :amount, presence: true
|
|
end
|