23 lines
483 B
Ruby
23 lines
483 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: order_products
|
|
#
|
|
# id :integer not null, primary key
|
|
# order_id :integer not null
|
|
# product_id :integer not null
|
|
# quantity :integer not null
|
|
# price :decimal(10, 2) not null
|
|
# created_at :datetime
|
|
# updated_at :datetime
|
|
#
|
|
|
|
# order products model
|
|
class OrderProduct < ApplicationRecord
|
|
belongs_to :product
|
|
belongs_to :order
|
|
|
|
def multiple_price
|
|
quantity * price
|
|
end
|
|
end
|