From 4cfb1a1253af420c1a0ef4b92b4cfa83d118c1a5 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 4 Oct 2022 10:28:37 +0200 Subject: [PATCH] (bug) create a category result in error --- .../api/product_categories/_product_category.json.jbuilder | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/api/product_categories/_product_category.json.jbuilder b/app/views/api/product_categories/_product_category.json.jbuilder index 6cdef711b..641a4d027 100644 --- a/app/views/api/product_categories/_product_category.json.jbuilder +++ b/app/views/api/product_categories/_product_category.json.jbuilder @@ -1,3 +1,4 @@ # frozen_string_literal: true -json.extract! product_category, :id, :name, :slug, :parent_id, :position, :products_count +json.extract! product_category, :id, :name, :slug, :parent_id, :position +json.products_count product_category.try(:products_count)