This story recounted by Dionysius of Halicarnassus (died after 7 BC), Livy (died Ad 12 or 17) and Plutarch (died after AD 119), the latter citing Livy directly but also using other sources. Their accounts are broadly similar, though not identical, and all mention the beating with rods by the children.
The story relates to a war fought by Rome against the Falerii, a city to the northeast of Rome, in 394 BC, and details the response of the Roman commander Marcus Furius Camillus (died 365 BC), when offered (Falerii) children as hostages by their treacherous tutor.
During an apparently lengthy siege, a tutor of the children of some of the prominent besieged residents took the children out of the city, supposedly for some exercise but instead led them to the Roman forces, intending to deliver them as hostages. The Roman commander, Marcus Furius Camillus, was not impressed though. From Livy Book 5, Chapter 27,
He [the tutor] had, he said, given Falerii into the hands of the Romans, since
those boys, whose fathers were at the head of affairs in the city,
were now placed in their power. 7 On hearing this Camillus replied,
‘You, villain, have not come with your villainous offer to a nation or
a commander like yourself. 8 Between us and the Faliscans there is
no fellowship based on a formal compact as between man and man, but
the fellowship which is based on natural instincts exists between us,
and will continue to do so. There are rights of war as there are
rights of peace, and we have learnt to wage our wars with justice no
less than with courage. 9 We do not use our weapons against those of
an age which is spared even in the capture of cities, but against
those who are armed as we are, and who without any injury or
provocation from us attacked the Roman camp at Veii. 10 These men
you, as far as you could, have vanquished by an unprecedented act of
villainy; I shall vanquish them as I vanquished Veii, by Roman arts,
by courage and strategy and force of arms.’ 11 He then ordered him to
be stripped and his hands tied behind his back, and delivered him up
to the boys to be taken back to Falerii, and gave them rods with which
to scourge the traitor into the city.
Dionysius of Halicarnassus' account is slightly different, with the added detail that Camillus first asked the Roman senate what he should do with the child hostages and their tutor. From Roman Antiquities, Book XIII:
Camillus, having handed over the schoolmaster and the boys to be
guarded, sent word by letter to the senate of what had happened and
inquired what he should do. When the senate gave him permission to
do whatever seemed best to him, he led the schoolmaster together with
the boys out of the camp and ordered his general's tribunal to be
placed not far from the city gate; and when a large crowd of the
Faliscans had rushed up, some of them to the walls and some to the
gate, he first showed them what an outrageous thing the schoolmaster
had dared to do to them; then he ordered his attendants to tear off
the man's clothes and to rend his body with a great many whips. When
he had had his fill of this punishment, he handed out rods to the boys
and ordered them to conduct the man back to the city with his hands
bound behind his back, beating him and maltreating him in every way.
Impressed by the Camillus' refusal to accept the help of such a traitor, the residents decided to end their resistance to Rome. Livy again:
The Roman sense of honour, the commander's love of justice, were in
all men's mouths in the forum and in the senate, and in accordance
with the universal wish, ambassadors were despatched to Camillus in
the camp, and with his sanction to the senate in Rome, to make the
surrender of Falerii.
"Furius Camillus and the Schoolmaster of Falerii" by Nicolas Poussin (1637), though not showing the rods mentioned by Dionysius, Livy and Plutarch. Source: PubHist
Dionysus simply says:
After the Faliscans had got their sons back and had punished the
schoolmaster in a manner his wicked plan deserved, they delivered
their city up to Camillus.
Plutarch's account is closer to Livy's, and there seems to be a confusion among the sources as to when Camillus contacted the senate, before or after the tutor was punished and the boys returned. In any case, peace ensued but Camillus was to pay a price as his soldiers were denied booty because the Falerian city was not sacked. Plutarch, in The Life of Camillus:
...the soldiers thought to have had the sacking of Falerii, and when
they came back to Rome empty-handed, they denounced Camillus to the
rest of the citizens as a hater of the common people, and as
begrudging to the poor the enjoyment of their rightful booty.
Over the following 150 years, the Falerii were mostly, though not always, at peace with Rome. In 351 BC, they sided with the Tarquinii against Rome but, less than ten years later during the First Samnite war in 342 BC, asked for a permanent peace treaty. During the Third Samnite War (298 to 290 BC) they eventually joined the Etruscan city states after initially remaining out of the conflict.