Narrated from Imam Zainul Abideen (a.s.) that one day the Holy Prophet (S) gave his finger-ring to Amirul Momineen (a.s.) and said: Inscribe the words: Muhammad bin Abdullah on it. Ali (a.s.) entrusted it to an engraver who inscribed the desired words. The next day when Ali (a.s.) took back that ring from the engraver he saw that the words ‘Muhammad Rasoolullaah’ were engraved on it.
Ali said: “I did not tell you to engrave these words.” He replied: “O Ali! You are right. I made a mistake. My hands moved that way.” Ali brought that ring back to the Holy Prophet (S) and told him about the event. The Holy Prophet (S) wore it and said: “I am both Muhammad bin Abdullah and Muhammad Rasoolullaah.” Next morning when it was seen, the words ‘Aliyun Waliyullah’ were also found written thereon.
It astonished the Holy Prophet (S). Jibraeel came and said that the Almighty Allah says: “My dear! You inscribed what you desired and I inscribed what I desired.”
Reference:Hayat Al-Qulub Vol. 2