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

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -