Commit a1e56773 by ivan Lan

Idiot

parent 935fe548
......@@ -58,11 +58,11 @@ module Shotengai
# where("spec->'$.\"颜色\"' = ? and spec->'$.\"大小\"' = ?" ,红色,S)
scope :query_spec_value_with_product, ->(val, product, eql: true) {
if val.keys.sort == shotengai_product.spec_template.keys.sort || (eql.! && (val.keys - shotengai_product.spec_template.keys).empty?)
if val.keys.sort == product.spec_template.keys.sort || (eql.! && (val.keys - product.spec_template.keys).empty?)
keys = []; values = [];
proc = Proc.new { |k, v| keys << "spec_value->'$.\"#{k}\"' = ? "; values << v }
Shotengai::Harray === val ? val.hash_map(&proc) : val.map(&proc)
where(product: shotengai_product).where(keys.join(' and '), *values)
where(product: product).where(keys.join(' and '), *values)
else
self.none
end
......
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