I\'m trying to do something that I thought it would be simple but it seems not to be.
I have a project model that has many vacancies.
class Project &
Yeah, vacancies is not a field in the join. I believe you want:
vacancies
Project.joins(:vacancies).group("projects.id").having("count(vacancies.id)>0")