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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -