Update Price#variant

This commit is contained in:
Matt-Yorkley
2021-03-26 19:21:21 +00:00
parent 2c1305b99e
commit 558457993a

View File

@@ -4,7 +4,7 @@ module Spree
class Price < ActiveRecord::Base
acts_as_paranoid without_default_scope: true
belongs_to :variant, class_name: 'Spree::Variant'
belongs_to :variant, -> { with_deleted }, class_name: 'Spree::Variant'
validate :check_price
validates :amount, numericality: { greater_than_or_equal_to: 0 }, allow_nil: true
@@ -26,11 +26,6 @@ module Spree
self[:amount] = parse_price(price)
end
# Allow prices to access associated soft-deleted variants.
def variant
Spree::Variant.unscoped { super }
end
private
def check_price