Mishkat al-Masabih #3232
Marriage
The Arabic includes the chain of narration (sanad) and the collector's commentary; the English translation shows the Prophet's words only.
أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسلم وَهَبَ لِعَلِيٍّ غُلَامًا فَقَالَ: «لَا تَضْرِبْهُ فَإِنِّي نُهِيتُ عَنْ ضَرْبِ أَهْلِ الصَّلَاةِ وَقَدْ رَأَيْتُهُ يُصَلِّي» . هَذَا لفظ المصابيح
Abu Umama told that God’s Messenger gave ‘Ali a youth and said, “Do not beat him, for I have been prohibited from beating people who observe the prayer, and I have seen him praying.”
This is the wording in al-Masabih.
About Mishkat al-Masabih
This hadith is #3232 from Mishkat al-Masabih, in the Book of Marriage.