The rest of the crew knew Donnie was questioned by the cops. Ray was supposed to be a leader of the gang. Now, he has to do something to keep the discipline and to keep anyone from wavering in their devotion to the cause. His decision: beat and frighten the potential snitch.
To understand the group dynamic here, go by what the other members of the crew knew.
The newest member of the team, their driver, was approached by the cops and questioned.
Their whole plan is potentially in danger! What does he know? What did he tell them?
The doubts about the plan start to blossom. Aren't 3 million dollars enough for us? One of us died to get those, should we quit while we are ahead? Should we trust him, our driver, now that he is compromised? Should I, as a gang member, trust any of the others? The pressure is higher now, the uncertainty greater.
When you are uncertain, who do you turn to guidance? Our leader, that's who. And that leader is Ray. Who trusts in the plan, but doesn't necessarily trust Donnie.
Now, look at what cops know.
Cops know that Donnie is connected to the gang. He is the smallest fry of them all. Works as a bartender as a honest job, drives for the gang when he needs some quick cash. He owns nothing, no fancy apartments, no pools, no fancy cars, nothing. He does work as a driver for the gang (that's how he was originally caught and why he was sent to prison, he has mad driving skills and he stole a car) and that is as far as cops know. Gang (except for Ray) know that he is connected as a driver.
Donnie was tortured by cops. What does he tell the cops? As much as he can as to get off the hook without getting in deeper trouble. I mean, "he is small fry, the gang doesn't trust him with much. I just drive cars." is what cops believe is true. Even if he told them the truth "I am the mastermind" they wouldn't have believed him.
"You, a small car thief, a mastermind and leader? Please. Those guys were soldiers, Ray won't work under any one, he was always a leader in any and all robberies he committed. You're a driver. Why would a mastermind do the job of a driver?"
So they let him go, scared and doubtful. Or so they thought.
What does Ray know? Donnie knows everything and was tortured by cops. The whole plan is in danger!
So what does Ray do when he finds out he was questioned and let go? A very violent public questioning of the potential snitch. He does the same thing that cops did, beats him and threatens to kill him. And finishes that questioning to the group's (of tough guys) and his own satisfaction. If Donnie didn't snitch to the rest of the gang after that questioning, he didn't snitch to the cops either. The order is restored, we are all on the same page again.