Create query for #273.

@allspiritseve 

Working on #273, I was wondering how to convert this query to Active Record stuff (and if you cared or not). I thought it'd be better for consistency if we convert it; I'm just not sure how. Is it absolutely necessary to add the has_-ish relationships in the model to perform table joins?