In the product relation I have belongs_to :category and in category relation I have has_many :products. What do I have to add to access product.category.name in a template. Error is : “undefined method `category’ for an instance of H22::Views::Parts::Product”
It seems I have to define category someplace other than by the relations
Hi @joeradtke — on their own, the associations don’t load any extra data. However, they allow you to use combines to achieve what you want. Give that page a read: it shows how you can use associations and combines together to get the nested data in return.
Thank you. I’m getting there slowly. I’m really liking Hanami but it’s quite challenging