I have three models: Project, Year, and Category
Project has a HABTM relationship with both years and categories.
I’m trying to get all projects that belong to both a given category and a given year.
Something like Project.where("year.name = ? and category.name = ?", "2012", "print") But I’m not sure how to do this with associated models rather than attributes of the model.
Thanks
Try