mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Update shipping_category association in models
This commit is contained in:
@@ -33,7 +33,6 @@ module Spree
|
||||
searchable_associations :supplier, :properties, :primary_taxon, :variants
|
||||
searchable_scopes :active, :with_properties
|
||||
|
||||
belongs_to :shipping_category, class_name: 'Spree::ShippingCategory'
|
||||
belongs_to :supplier, class_name: 'Enterprise', optional: false, touch: true
|
||||
belongs_to :primary_taxon, class_name: 'Spree::Taxon', optional: false, touch: true
|
||||
|
||||
@@ -52,7 +51,6 @@ module Spree
|
||||
through: :variants
|
||||
|
||||
validates :name, presence: true
|
||||
validates :shipping_category, presence: true
|
||||
|
||||
validates :variant_unit, presence: true
|
||||
validates :unit_value, presence:
|
||||
|
||||
@@ -29,9 +29,9 @@ module Spree
|
||||
|
||||
belongs_to :product, -> { with_deleted }, touch: true, class_name: 'Spree::Product'
|
||||
belongs_to :tax_category, class_name: 'Spree::TaxCategory'
|
||||
belongs_to :shipping_category, class_name: 'Spree::ShippingCategory'
|
||||
|
||||
delegate_belongs_to :product, :name, :description, :shipping_category_id,
|
||||
:meta_keywords, :shipping_category
|
||||
delegate_belongs_to :product, :name, :description, :meta_keywords
|
||||
|
||||
has_many :inventory_units, inverse_of: :variant
|
||||
has_many :line_items, inverse_of: :variant
|
||||
@@ -63,6 +63,7 @@ module Spree
|
||||
|
||||
validate :check_currency
|
||||
validates :price, numericality: { greater_than_or_equal_to: 0 }, presence: true
|
||||
validates :shipping_category, presence: true
|
||||
validates :tax_category, presence: true,
|
||||
if: proc { Spree::Config[:products_require_tax_category] }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user