When no assignment is made to `ids` (e.g. when `account` or `member` are not found), the return value of the block is `nil`, so `ids` will hold `nil` on the next iteration, which will then lead to a NoMethodError when `<<` is called on `ids`. It should be enough to add `ids` to the end of the block to always return something that is not `nil`.