Anāthapiṇḍika loses all his wealth, and laments one day to the Buddha that he can only afford to give to the monks a coarse mixture of broken rice grains and sour gruel. The quality of the food is not important, says the Buddha, but only the heart of the giver, whether the giving is done casually or considerately and with devotion, and whether the recipients are worthy. He then tells of the great gifts made by Velāma. Though the gifts were great, Velāma could find no holy persons as recipients. The Buddha then goes on to say that greater than the giving of alms, or even the building of monasteries, is the taking of the Refuges, the observance of good conduct, the practice of amity, and the thinking of impermanence, each of these being greater than the last. (A.iv.392 ﬀ; the sutta is referred to at DhA.iii.11; KhA.222; DA.i.234 VibhA.414).
It was on this occasion that the Khadiraṅgāra Jātaka was taught.