activerecord - How to write using where and and conditions on active record rails -


how write query using , and conditions on active record rails

select c.name fromcategoriesas c join categories_coaches cc on cc.category_id=c.id cc.coach_id=16 , c.parent_id=1

this should it:

category.joins(:categories_coaches)     .where('categories_coaches.id = ? , categories.parent_id = ?', 16, 1)     .select('categories.name') 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -