ruby - Rails returning all of second level association -


i have 3 models interested in: region, seat , user.

region has many seats , seats have many available users.

i'd know efficient way in rails retrieve of available users seats sit under particular region.

thanks in advance.

try:

user.joins(seat: :region).where(regions: { id: region_id_here }) 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -