mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-10 23:07:47 +00:00
Fix Rails/HasManyOrHasOneDependent with nil
This commit is contained in:
@@ -36,7 +36,7 @@ module Spree
|
||||
# Deletion of metadata is handled in the database.
|
||||
# So we don't need the option `dependent: :destroy` as long as
|
||||
# AdjustmentMetadata has no destroy logic itself.
|
||||
has_one :metadata, class_name: 'AdjustmentMetadata', dependent: :destroy
|
||||
has_one :metadata, class_name: 'AdjustmentMetadata', dependent: nil
|
||||
has_many :adjustments, as: :adjustable, dependent: :destroy
|
||||
|
||||
belongs_to :adjustable, polymorphic: true
|
||||
|
||||
@@ -21,7 +21,7 @@ module Spree
|
||||
|
||||
belongs_to :zone, class_name: "Spree::Zone", inverse_of: :tax_rates
|
||||
belongs_to :tax_category, class_name: "Spree::TaxCategory", inverse_of: :tax_rates
|
||||
has_many :adjustments, as: :originator, dependent: :destroy
|
||||
has_many :adjustments, as: :originator, dependent: nil
|
||||
|
||||
validates :amount, presence: true, numericality: true
|
||||
validates :tax_category, presence: true
|
||||
|
||||
@@ -14,7 +14,7 @@ module Spree
|
||||
encryptor: 'authlogic_sha512', reconfirmable: true,
|
||||
omniauth_providers: [:openid_connect]
|
||||
|
||||
has_many :orders
|
||||
has_many :orders, dependent: nil
|
||||
belongs_to :ship_address, class_name: 'Spree::Address'
|
||||
belongs_to :bill_address, class_name: 'Spree::Address'
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ module Spree
|
||||
|
||||
delegate :name, :name=, :description, :description=, :meta_keywords, to: :product
|
||||
|
||||
has_many :inventory_units, inverse_of: :variant, dependent: :destroy
|
||||
has_many :line_items, inverse_of: :variant, dependent: :destroy
|
||||
has_many :inventory_units, inverse_of: :variant, dependent: nil
|
||||
has_many :line_items, inverse_of: :variant, dependent: nil
|
||||
|
||||
has_many :stock_items, dependent: :destroy, inverse_of: :variant
|
||||
has_many :stock_locations, through: :stock_items
|
||||
|
||||
Reference in New Issue
Block a user