# == Schema Information # # Table name: cart_products # # id :bigint(8) not null, primary key # cart_id :bigint(8) not null # product_id :integer not null # quantity :integer not null # price :decimal(10, 2) not null # created_at :datetime # updated_at :datetime # # Shopping cart_products class CartProduct < ApplicationRecord belongs_to :cart belongs_to :product def multiple_price quantity * price end end