I have this relationship in my MySQL database:
Now i want to access the "is_main" attribute from the middle table "product_image", for example:
I can't do the above example because is_main is not part of the "image" table.
I tried doing something like this too:
But it not worked. In short, I want to access the "is_main" attribute when I have a product instance. Can I access the "is_main" attribute and the respective image table using only one database request?
My model:
I think I don't need to post my product and image models.
Thanks!