First off, you need to activate all 3 switches so the train can safely make it to the end of the first part of the level. Then you need to return to the beginning of the level using the purple gem to proceed past the dead-ends. When you reach the very beginning, the camera will change to a bad angle, so use the purple gem to move the camera to behind Sonic. Hit the proper dash pad holding the Right Trigger and the camera will be permanently stuck unless the purple gem is being used. When you go through the trick rings, the camera resets to its "stuck" location, but you still get the points for the trick ring you went through. I don't quite understand exactly why the trick ring doesn't disappear, but maybe it has to do with the camera resetting to a place where the ring is outside of the draw distance before it has a chance to vanish.
Basically, you can keep going through the ring over and over again for point scalping.