cleaning up touches

This commit is contained in:
Will Marshall
2014-07-02 13:17:54 +10:00
parent 487b8616c0
commit b005d0860e
4 changed files with 1 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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