From 0937cc64b1e407390d29a73d148d53eb22194941 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Wed, 2 May 2018 13:07:14 +0200 Subject: [PATCH] Do not assign order_id on inventory units in specs order_id column has been removed from solidus since solidusio/solidus#2377. Now the order reference will be taken from the shipment in which the inventory units are included. --- lib/solidus_expedited_exchanges/unreturned_item_charger.rb | 2 +- lib/tasks/exchanges.rake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/solidus_expedited_exchanges/unreturned_item_charger.rb b/lib/solidus_expedited_exchanges/unreturned_item_charger.rb index a9e3b41..9f0a5cb 100644 --- a/lib/solidus_expedited_exchanges/unreturned_item_charger.rb +++ b/lib/solidus_expedited_exchanges/unreturned_item_charger.rb @@ -62,7 +62,7 @@ def add_exchange_variants_to_order @return_items.group_by(&:exchange_variant).map do |variant, variant_return_items| variant_inventory_units = variant_return_items.map(&:exchange_inventory_unit) line_item = Spree::LineItem.create!(variant: variant, quantity: variant_return_items.count, order: new_order) - variant_inventory_units.each { |i| i.update_attributes!(line_item_id: line_item.id, order_id: new_order.id) } + variant_inventory_units.each { |i| i.update_attributes!(line_item_id: line_item.id) } end end diff --git a/lib/tasks/exchanges.rake b/lib/tasks/exchanges.rake index bee8b16..260a23f 100644 --- a/lib/tasks/exchanges.rake +++ b/lib/tasks/exchanges.rake @@ -9,7 +9,7 @@ namespace :exchanges do # Determine that a return item has already been deemed unreturned and therefore charged # by the fact that its exchange inventory unit has popped off to a different order - unreturned_return_items.select! { |ri| ri.inventory_unit.order_id == ri.exchange_inventory_unit.order_id } + unreturned_return_items.select! { |ri| ri.inventory_unit.order.id == ri.exchange_inventory_unit.order.id } failures = []