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