That was my initial thought, but as Dom pointed out there are other ways in which attachable can end up as nil. Sure enough, querying like this yields 180 or so results whereas there aren't any where attachable_id is nil.