Commit 5a2e875a by ivan Lan

Remove all touch: true option of belongs to

parent 30d15ee6
......@@ -59,7 +59,7 @@ module Shotengai
class_name: self.name,
optional: true,
foreign_key: :shotengai_order_id,
touch: true,
# touch: true,
)
end
end
......
......@@ -25,7 +25,7 @@ module Shotengai
class << self
def inherited subclass
subclass.has_many :sub_catalogs, class_name: subclass.name, foreign_key: :super_catalog_id
subclass.belongs_to :super_catalog, class_name: subclass.name, optional: true, touch: true
subclass.belongs_to :super_catalog, class_name: subclass.name, optional: true#, touch: true
# subclass.instance_eval("def klass; #{subclass}; end")
super
end
......
......@@ -31,7 +31,7 @@ module Shotengai
class Order < ActiveRecord::Base
self.table_name = 'shotengai_orders'
belongs_to :buyer, polymorphic: true, optional: true, touch: true
belongs_to :buyer, polymorphic: true, optional: true#, touch: true
default_scope { where.not(status: 'cart') }
scope :status_is, ->(status) { where(status.blank?.! && { status: status }) }
......@@ -179,7 +179,7 @@ module Shotengai
class_name: self.name,
optional: true,
foreign_key: :shotengai_order_id,
touch: true,
# touch: true,
)
end
......
......@@ -30,7 +30,7 @@ module Shotengai
require 'acts-as-taggable-on'
self.table_name = 'shotengai_products'
belongs_to :manager, polymorphic: true, optional: true, touch: true
belongs_to :manager, polymorphic: true, optional: true#, touch: true
validate :check_spec, if: :spec
include AASM_DLC
......
......@@ -52,8 +52,8 @@ module Shotengai
def add_associations subclass, product_name
# belongs to Product
subclass.belongs_to :product, foreign_key: :shotengai_product_id, class_name: product_name, touch: true
subclass.belongs_to product_name.underscore.to_sym, foreign_key: :shotengai_product_id, class_name: product_name, touch: true
subclass.belongs_to :product, foreign_key: :shotengai_product_id, class_name: product_name#, touch: true
subclass.belongs_to product_name.underscore.to_sym, foreign_key: :shotengai_product_id, class_name: product_name#, touch: true
# has many snapshot
subclass.has_many :snapshots, class_name: "#{product_name}Snapshot", foreign_key: :shotengai_series_id
end
......
......@@ -35,9 +35,9 @@ module Shotengai
validate :cannot_edit_if_order_is_paid
belongs_to :shotengai_order, foreign_key: :shotengai_order_id,
class_name: 'Shotengai::Order', optional: true, touch: true
class_name: 'Shotengai::Order', optional: true#, touch: true
belongs_to :shotengai_cart, foreign_key: :shotengai_order_id,
class_name: 'Shotengai::Cart', optional: true, touch: true
class_name: 'Shotengai::Cart', optional: true#, touch: true
scope :in_order, -> { joins(:shotengai_order).where.not(shotengai_orders: { status: 'cart'}) }
scope :in_cart, -> { joins(:shotengai_order).where(shotengai_orders: { status: 'cart'}) }
......@@ -47,8 +47,8 @@ module Shotengai
product_name = /^(.+)Snapshot/.match(subclass.name)[1]
series_name = "#{product_name}Series"
# belongs to Series
subclass.belongs_to :series, foreign_key: :shotengai_series_id, class_name: series_name, touch: true
subclass.belongs_to series_name.underscore.to_sym, foreign_key: :shotengai_series_id, class_name: series_name, touch: true
subclass.belongs_to :series, foreign_key: :shotengai_series_id, class_name: series_name#, touch: true
subclass.belongs_to series_name.underscore.to_sym, foreign_key: :shotengai_series_id, class_name: series_name#, touch: true
# 加载自定义文件
require_custom_file(product_name) if Rails.root
super
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment