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

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -