We used to go on military expeditions with the Messenger of Allah ﷺ during Ramadan. Some of us fasted and some did not. Those who fasted held no grievance against those who broke their fast, and those who broke their fast held no grievance against those who fasted. They considered that whoever had the strength to fast, it was good for him to do so, and whoever felt weakness and broke his fast, that too was good.
كنا نغزو مع رسول الله ﷺ في رمضان، فمنا الصائم، ومنا المفطر. فلا يجد الصائم على المفطر، ولا المفطر على الصائم. يرون أن من وجد قوة فصام، فإن ذلك حسن، ويرون أن من وجد ضعفا فأفطر فإن ذلك حسن.
Muslim narrated it in the Hajj chapter (1116:96), from Amr Naqid, who said, "Ismail bin Ibrahim narrated to us, from Jareeri, from Abu Nadra, from Abu Saeed Khudri," and he related the hadith.Ibn Khuzayma claimed in his Sahih (3/260), "In the hadith of Ibn Ulaya it says, 'We used to go out in the morning' (this is how it reads, though I think the correct wording is 'we used to raid'), 'with the Messenger of Allah ﷺ.' He did not say, 'in Ramadan.'"But this is not as he claimed. Rather, in Muslim's version it is explicit that it took place in Ramadan, and Ismail bin Ibrahim is Ibn Ulaya. Yazid bin Zuray said the same, from Jareeri. Ibn Hibban narrated it (3558) through his route.