module Users class TablesController < Users::ApplicationController def show @table = Table.find(params[:id]) render json: JSONAPI::Serializer.serialize(@table, serializer: Users::TableSerializer) end def supplier table = Table.find(params[:id]) supplier = table.supplier supplier.product_categories.include_relations(:products) render json: JSONAPI::Serializer.serialize(supplier, serializer: Users::SupplierSerializer, include: %w[product_categories product_categories.products product_categories.supplier]) end end end