Commit a8f6abcb by ivan Lan

Add base class relations to series and snapshot

parent 1ecc6c20
...@@ -50,6 +50,9 @@ module Shotengai ...@@ -50,6 +50,9 @@ module Shotengai
delegate :title, :detail, :banners, :cover_image, :status, :status_zh, :manager, to: :product delegate :title, :detail, :banners, :cover_image, :status, :status_zh, :manager, to: :product
belongs_to :shotengai_product, foreign_key: :shotengai_product_id,
class_name: 'Shotengai::Product'#, touch: true
scope :alive, -> { where.not(aasm_state: 'deleted') } scope :alive, -> { where.not(aasm_state: 'deleted') }
scope :recycle_bin, ->{ unscope(where: :aasm_state).deleted.where('updated_at < ?', Time.now - 10.day )} scope :recycle_bin, ->{ unscope(where: :aasm_state).deleted.where('updated_at < ?', Time.now - 10.day )}
......
...@@ -54,6 +54,8 @@ module Shotengai ...@@ -54,6 +54,8 @@ module Shotengai
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, 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
belongs_to :shotengai_series, foreign_key: :shotengai_series_id,
class_name: 'Shotengai::Series'#, touch: true
belongs_to :manager, polymorphic: true, optional: true belongs_to :manager, polymorphic: true, optional: true
before_save :set_manager before_save :set_manager
......
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