Sha256: 9914d5a82d8731b195a2eae48ae60b57bf10581f1120569e9b98fac5e62b76a8

Contents?: true

Size: 408 Bytes

Versions: 3

Compression:

Stored size: 408 Bytes

Contents

# sales_order = Bouquet::SalesOrder.new(quantity: 1, customer_id: 1, product_id: 1)
# sales_order.save
# Bouquet::SalesOrder.last.shipping
module Bouquet
  class SalesOrder < ApplicationRecord
    belongs_to :product
    belongs_to :customer
    has_one :shipment, dependent: :destroy

    def shipping
      shipment = build_shipment
      shipment.date = Time.current
      shipment.save
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bouquet-0.2.2 core/app/models/bouquet/sales_order.rb
bouquet-0.2.1 core/app/models/bouquet/sales_order.rb
bouquet-0.2.0 core/app/models/bouquet/sales_order.rb