Commit 8eab964e by ivan Lan

Fix query_spec_with_product of Series

parent 5a2e875a
...@@ -69,8 +69,8 @@ RSpec.describe "#{namespace}/products/:product_id/product_series", type: :reques ...@@ -69,8 +69,8 @@ RSpec.describe "#{namespace}/products/:product_id/product_series", type: :reques
spec: { spec: {
type: :object, type: :object,
properties: { properties: {
color: { type: :array }, color: { type: :string },
size: { type: :array }, size: { type: :string },
}, },
}, },
meta: { meta: {
...@@ -143,8 +143,8 @@ RSpec.describe "#{namespace}/products/:product_id/product_series", type: :reques ...@@ -143,8 +143,8 @@ RSpec.describe "#{namespace}/products/:product_id/product_series", type: :reques
spec: { spec: {
type: :object, type: :object,
properties: { properties: {
color: { type: :array }, color: { type: :string },
size: { type: :array }, size: { type: :string },
}, },
}, },
meta: { meta: {
......
...@@ -35,7 +35,7 @@ module Shotengai ...@@ -35,7 +35,7 @@ module Shotengai
if val.keys.sort == product.spec.keys.sort if val.keys.sort == product.spec.keys.sort
keys = []; values = [] keys = []; values = []
val.map { |k, v| keys << "spec->'$.\"#{k}\"' = ? "; values << v } val.map { |k, v| keys << "spec->'$.\"#{k}\"' = ? "; values << v }
where(keys.join(' and '), *values) where(product: product).where(keys.join(' and '), *values)
else else
self.none self.none
end 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