Simple. Create another curve that follows one of the rails. Animate a locator along that path. Aim constraint the cart to the locator. Done.