When Rest in Peace enters the battlefield, it has a triggered ability that will exile all graveyards. This ability goes on the stack, and both players get a chance to respond before the ability can resolve. So you can cast Ray of Revelation using its Flashback cost to destroy the Rest in Peace.
As Ray of Revelation resolves, Rest in Peace would be destroyed and put into a graveyard. However, since it’s still on the battlefield at that point, its replacement effect will apply to itself! Rest in Peace is exiled as it’s destroyed. Then Ray of Revelation is exiled because of the Flashback replacement effect… but if it had been cast from your hand, it would have gone to the graveyard. That’s because the very last part of a spell resolving is being put into the graveyard (unless it says otherwise). At that point, Rest in Peace is already out of the picture.
Of course, after Ray of Revelation has finished resolving, both players have to pass priority to let the trigger from Rest in Peace resolve, which it will still do even though it is no longer on the battlefield (since an ability on the stack exists independently from its source). So in this particular case, Ray of Revelation would have ended up getting exiled regardless. You would have had to wait for Rest in Peace’s trigger to exile everything first before casting Ray of Revelation from your hand if you wanted it to end up in your otherwise-empty graveyard.
Today’s Rules Tip written by Nick Rutkowski, Level 2 judge from El Cerrito, CA