If I have models like:
User hasMany house hasMany belongings
and I want to select all Users and the related models, but only if the user has one or more belongings--how would I set that condition? Thanks!!
If I have models like:
User hasMany house hasMany belongings
and I want to select all Users and the related models, but only if the user has one or more belongings--how would I set that condition? Thanks!!
use counterCache, then you can set the condition in pagination: 'belonging_count >'=> 0