Commit 0b76f7be by ivan Lan

Set default val to meta

parent 12f877a6
...@@ -124,6 +124,10 @@ module Shotengai ...@@ -124,6 +124,10 @@ module Shotengai
end end
end end
def meta
super || {}
end
class << self class << self
def inherited subclass def inherited subclass
# define Cart class # define Cart class
......
...@@ -63,6 +63,10 @@ module Shotengai ...@@ -63,6 +63,10 @@ module Shotengai
Shotengai::Series.find_by_id(default_series_id) || series.first Shotengai::Series.find_by_id(default_series_id) || series.first
end end
def meta
super || {}
end
class << self class << self
def series_class def series_class
Shotengai::Series Shotengai::Series
......
...@@ -30,7 +30,7 @@ module Shotengai ...@@ -30,7 +30,7 @@ module Shotengai
delegate :title, :detail, :banners, :cover_image, :status, :status_zh, to: :product delegate :title, :detail, :banners, :cover_image, :status, :status_zh, to: :product
# where(spec->'$.\"颜色\"' = ? and spec->'$.\"大小\"' = ? ,红色,S) # where("spec->'$.\"颜色\"' = ? and spec->'$.\"大小\"' = ?" ,红色,S)
scope :query_spec_with_product, ->(val, product) { scope :query_spec_with_product, ->(val, product) {
if val.keys.sort == product.spec.keys.sort if val.keys.sort == product.spec.keys.sort
keys = []; values = [] keys = []; values = []
...@@ -72,6 +72,10 @@ module Shotengai ...@@ -72,6 +72,10 @@ module Shotengai
read_attribute(:original_price) || price read_attribute(:original_price) || price
end end
def meta
super || {}
end
private private
# spec 字段 # spec 字段
def check_spec_value def check_spec_value
......
...@@ -119,6 +119,10 @@ module Shotengai ...@@ -119,6 +119,10 @@ module Shotengai
def order_status_zh; shotengai_order&.status_zh end def order_status_zh; shotengai_order&.status_zh end
###### ######
def meta
super || {}
end
private private
# spec 字段 # spec 字段
......
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