From 0a1cb71ee4f8b64c52ade2a98d73563e2f524460 Mon Sep 17 00:00:00 2001 From: Kristina Lim Date: Thu, 14 May 2020 05:00:52 +0800 Subject: [PATCH] Ignore Rails/UniqueValidationWithoutIndex for unique index of StockItem#stock_location --- app/models/spree/stock_item.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/spree/stock_item.rb b/app/models/spree/stock_item.rb index 47c311b205..9eca73d0c8 100644 --- a/app/models/spree/stock_item.rb +++ b/app/models/spree/stock_item.rb @@ -7,7 +7,9 @@ module Spree has_many :stock_movements, dependent: :destroy validates :stock_location, :variant, presence: true + # rubocop:disable Rails/UniqueValidationWithoutIndex validates :variant_id, uniqueness: { scope: :stock_location_id } + # rubocop:enable Rails/UniqueValidationWithoutIndex attr_accessible :count_on_hand, :variant, :stock_location, :backorderable, :variant_id