The Bodhisatta was once a golden mallard, and all the birds chose him as their king. He had granted his lovely daughter one wish, and she asked to choose her own husband. So the Bodhisatta called all manner of birds to gather, and taken by his beauty she chose the peacock. Overcome with joy, the peacock spread his wings and began to dance, thus exposing himself. The Bodhisatta shamed the peacock for his lack of decency and gave his daughter to a young mallard instead.
In the Lifetime of the Buddha
The peacock was an earlier birth of a disciple who had amassed a great number of robes despite having taken a vow to live a modest life. When the Buddha questioned him about it the disciple lost his cool and tore off all his clothes, yelling “I will go about like this!” He then ran away naked and became a layman again.
Later the Buddha heard some of his disciples discussing the incident and he told them this story so they knew it was not the first time this disciple’s shamelessness had cost him something valuable.