From 02d0b7e88c5f151ea4d5d27a33c973ee5be11ddc Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 4 Dec 2018 15:25:38 +0000 Subject: [PATCH] Improve comment on VariantStock#move --- app/models/concerns/variant_stock.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/variant_stock.rb b/app/models/concerns/variant_stock.rb index 14a13293be..9b636efb8f 100644 --- a/app/models/concerns/variant_stock.rb +++ b/app/models/concerns/variant_stock.rb @@ -115,8 +115,11 @@ module VariantStock def move(quantity, originator = nil) raise_error_if_no_stock_item_available - # Creates a stock movement (this is the original spree stock_location.move) - # This will update stock_item.count_on_hand and fill backorders + # Creates a stock movement: it updates stock_item.count_on_hand and fills backorders + # + # This is the original Spree::StockLocation#move, + # except that we raise an error if the stock item is missing, + # because, unlike Spree, we should always have exactly one stock item per variant. stock_item.stock_movements.create!(quantity: quantity, originator: originator) end