Sha256: 2f9725300c5be7c69159cbe6c843c6c1e3b93e164567ff75f45bbca762025f5f
Contents?: true
Size: 495 Bytes
Versions: 34
Compression:
Stored size: 495 Bytes
Contents
module Workarea class CreateFulfillment def initialize(order) @order = order end def fulfillment @fulfillment ||= Fulfillment.find_or_initialize_by(id: @order.id) end def perform @order.items.each do |item| next if fulfillment.items.detect { |i| i.order_item_id == item.id.to_s } fulfillment.items.build( order_item_id: item.id, quantity: item.quantity ) end fulfillment.save! end end end
Version data entries
34 entries across 34 versions & 1 rubygems