Sha256: 4f1b0c2aea3b195c4bac5e4d497a0eb07e0de5de0b1476abbf886479e96c6386
Contents?: true
Size: 705 Bytes
Versions: 3
Compression:
Stored size: 705 Bytes
Contents
# purchase_order = Bouquet::PurchaseOrder.new(quantity: 1, material_id: 1, supplier_id: 1) # purchase_order.save # purchase_order.arrival.stocks.first.storages.first module Bouquet class PurchaseOrder < ApplicationRecord belongs_to :material belongs_to :supplier has_one :arrival, dependent: :destroy after_create do location = Bouquet::Location.first arrival = build_arrival(quantity: quantity, date: Time.current) arrival.save stock = arrival.stocks.new(quantity: quantity, date: Time.current, location_id: location.id) stock.save storage = stock.storages.new(initial_quantity: quantity, date: Time.current) storage.save end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bouquet-0.2.2 | core/app/models/bouquet/purchase_order.rb |
bouquet-0.2.1 | core/app/models/bouquet/purchase_order.rb |
bouquet-0.2.0 | core/app/models/bouquet/purchase_order.rb |