Hello. I’m just curious regarding the table structure, why would you use a blind integer key instead of using compound foreign key on an associative table (product_category) which does not have elements of its own ? I think it is best to use a many-to-many relations and therefore the relations should be :
I agree with previous poster - use many:many if a junction table is used that has no other meta information.
That said, if you do need to go the way you are proposing I prefer to use nested ‘with’ statements in my AR instead of relations with through.
I haven’t really figured out how to nest through relationships. Sometimes you end up with code that has 3-5 layers of relationships and nested ‘with’ statements just work.