move where clauses from controller into model scopes