mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Fix Rails/HasManyOrHasOneDependent with delete_all
This commit is contained in:
@@ -8,7 +8,7 @@ module Spree
|
||||
|
||||
belongs_to :stock_location, class_name: 'Spree::StockLocation', inverse_of: :stock_items
|
||||
belongs_to :variant, -> { with_deleted }, class_name: 'Spree::Variant'
|
||||
has_many :stock_movements, dependent: :destroy
|
||||
has_many :stock_movements, dependent: :delete_all # delete_all required to avoid ReadOnlyError
|
||||
|
||||
validates :stock_location, :variant, presence: true
|
||||
validates :variant_id, uniqueness: { scope: [:stock_location_id, :deleted_at] }
|
||||
|
||||
Reference in New Issue
Block a user