Ordinarily I put on railings last, and paint them first. In fact, I often paint the railings while they are still on the PE fret, touching up the marks where they are touched up after then are on.
The exception is if the superstructure is very complicated. Some older warships (around the 1900 era) have very complicated superstructure- sort of donut shaped, where there are railings towards the center of the ship. I do just these at an earlier stage, but the rest, like the main deck railings, last. I mention this in my article on the Dreadnaught in the Sept. FSM.