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
Post a Comment