So I have two tables: - teams - players I'm trying to find all teams that have no players. I thought this could work: Team.find(:all, :joins => :players, :conditions => ["players.size = ?", 0] ) Of course that's not working for me because I'm mixing the SQL with Rails. Do you know the proper way to find all teams that have no players?
on 2009-02-17 03:36
on 2009-02-17 03:47
You could add a :counter_cache to your model if you want a simple solution: http://api.rubyonrails.org/classes/ActiveRecord/As... On Feb 16, 8:36 pm, Bob S. <firstname.lastname@example.org>