Just had an interesting thing happen. Model.find_by_sql
with a few joins (it’s a complicated query) occasionally returns empty rows in the middle of the result set. Well, guess what? Those empty results were still Model objects, with id and all other attributes set to nil.
I only found out about it when I hit upon this exception:
NoMethodError: undefined method `join' for nil:NilClass
Deep in the routing code. Because the objects were not nil, it bypassed my usual nil catches. But journey still couldn’t make sense of it. Had to put a manual reject
call at the end,
Blegh. Coding is hard.