Two men were mentioned to the Messenger of Allah ﷺ, one a devoted worshipper and the other a scholar. The Messenger of Allah ﷺ said, "The superiority of the scholar over the worshipper is like my superiority over the least among you."Then the Messenger of Allah ﷺ said, "Indeed, Allah, His angels, the inhabitants of the heavens and the earths, even the ant in its hole, and even the fish, send blessings upon the one who teaches people what is good."
ذكر لرسول الله ﷺ رجلان أحدهما عابد، والآخر عالم، فقال رسول الله ﷺ: فضل العالم على العابد كفضلي على أدناكم. ثم قال رسول الله ﷺ: إن الله وملائكته، وأهل السموات والأرضين حتى النملة في جحرها، وحتى الحوت ليصلون على معلم الناس الخير.
Tirmidhi (2685) narrated it from Muhammad bin Abdul-Ala Sanani, who said, Salama bin Raja narrated to us, who said, Walid bin Jameel narrated to us, who said, Qasim Abu Abdul-Rahman narrated to us, from Abu Umama, and he related it.Its chain of transmission is hasan. Salama, Walid, and Qasim are all three at the rank of "truthful."Tirmidhi said, "This is a gharib hadith." In another copy, "This is a hasan gharib sahih hadith."As for his statement, "They surely pray for the one who teaches people what is good," Ibn Abdul-Barr said, "Prayer here means supplication and seeking forgiveness." See Jami Bayan Ilm (1/174).