Ignore Rails/UniqueValidationWithoutIndex for unique index of StockItem#stock_location

This commit is contained in:
Kristina Lim
2020-05-14 05:00:52 +08:00
committed by Luis Ramos
parent bc530b92b5
commit 0a1cb71ee4

View File

@@ -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