I have the following simple where find condition:
Player.where('id NOT IN (?)', @groups.collect {|g| g.player_ids}.flatten)
So this finds all players that are currently not in any groups, right? Well, the problem is that if there are no players in any groups, nothing is shown. The reason for this is the following SQL is generated:
SELECT "players".* FROM "players" WHERE (id NOT IN (NULL))
This seems like a strange default to me, and I've tested it in Rails 3.0.7 and 3.1.0.rc4 with the same result. Now I could create some conditions if @groups.collect {|g| g.player_ids} is empty, but is there a better way to do this?