Per the Sage Advice Compendium, you roll separately for each ray
The Sage Advice Compendium includes the following three questions and answers relating to the scorching ray spell. The first two appear in the sorcerer section:
A. That’s correct. Elemental Affinity benefits one damage roll per casting of a spell, even if the spell allows more than one roll. So, for example, the feature improves one of the rays of a scorching ray spell or one of the beams of an eldritch blast spell.
Q. Can Empowered Spell affect all the rays of a scorching ray spell, or just one?
A. A sorcerer’s Empowered Spell could affect more than one ray of a scorching ray, abiding by the feature’s die limit. For instance, if you create three rays with the spell and you have a +3 Charisma modifier, you could reroll one of the damage dice for each ray, or two of the damage dice for one ray and one of the damage dice for another one.
The last such ruingruling is in the section on spell attacks (emphasis mine):
A. Even though the duration of each of these spells is instantaneous, you choose the targets and resolve the attacks consecutively, not all at once. If you want, you can declare all your targets before making any attacks, but you would still roll separately for each attack (and damage, if appropriate).
All of these quotes establish that scorching ray involves multiple damage rolls (a separate roll for each ray that hits).
The rules themselves also lead to this conclusion, as detailed in BlueMoon93's answer.