When I have array of ids, like
ids = [2,3,5]
and I perform
Comment.find(ids)
everything works fine. But w
If it is just avoiding the exception you are worried about, the "find_all_by.." family of functions works without throwing exceptions.
Comment.find_all_by_id([2, 3, 5])
will work even if some of the ids don't exist. This works in the
user.comments.find_all_by_id(potentially_nonexistent_ids)
case as well.
Comment.where(id: [2, 3, 5])