Updated rake task to use "where" query instead of "active"