How not to show a record without related data

There are two tables - Categories and Products. But there may not be any category in the products. How not to show empty categories in the template?

Use an if tag in your template to check to see if there are any products in the category before rendering that category.

You’ll need to post the models and perhaps the portion of your current template where you render the categories if you need a more specific and detailed answer.