mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
cleaning up touches
This commit is contained in:
@@ -7,7 +7,7 @@ class Enterprise < ActiveRecord::Base
|
||||
has_many :producer_properties, foreign_key: 'producer_id'
|
||||
has_many :supplied_products, :class_name => 'Spree::Product', :foreign_key => 'supplier_id', :dependent => :destroy
|
||||
has_many :distributed_orders, :class_name => 'Spree::Order', :foreign_key => 'distributor_id'
|
||||
belongs_to :address, :class_name => 'Spree::Address', touch: true
|
||||
belongs_to :address, :class_name => 'Spree::Address'
|
||||
has_many :product_distributions, :foreign_key => 'distributor_id', :dependent => :destroy
|
||||
has_many :distributed_products, :through => :product_distributions, :source => :product
|
||||
has_many :enterprise_fees
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
Spree::Classification.class_eval do
|
||||
belongs_to :product, :class_name => "Spree::Product", touch: true
|
||||
belongs_to :taxon, :class_name => "Spree::Taxon", touch: true
|
||||
before_destroy :dont_destroy_if_primary_taxon
|
||||
|
||||
def dont_destroy_if_primary_taxon
|
||||
|
||||
@@ -5,7 +5,6 @@ Spree::Product.class_eval do
|
||||
has_many :option_types, :through => :product_option_types, :dependent => :destroy
|
||||
|
||||
belongs_to :supplier, :class_name => 'Enterprise', touch: true
|
||||
belongs_to :primary_taxon, class_name: 'Spree::Taxon', touch: true
|
||||
|
||||
has_many :product_distributions, :dependent => :destroy
|
||||
has_many :distributors, :through => :product_distributions
|
||||
|
||||
@@ -4,7 +4,6 @@ class Api::EnterpriseSerializer < ActiveModel::Serializer
|
||||
# Taxons:
|
||||
# classifications touch products
|
||||
# products touch suppliers
|
||||
# Taxon could change but unlikely: if becomes a problem dereference
|
||||
#
|
||||
# Relatives:
|
||||
# Enterprise_relationships touches parent, child
|
||||
|
||||
Reference in New Issue
Block a user