Lay down a rail.
Place a button with an adjacent rail and link the button to the original rail.
Press C on the button to confirm that the original rail is highlighted with a purple box.
Activate the button (to swap/change direction of the original rail).
Press C on the button and see that the original rail is no longer highlighted in purple.