I do the same thing: paint the deck and railings before installing. I cut a few strips of low-tack masking tape (nothing special, just from Walmart) and tape the railings in place in a few spots; just to hold them where they belong.
Then I use some thinned white glue--it's very thin, maybe up to 50% glue and 50% water. I apply it to the joint with a very small paint brush. It's probably a 10 0. I let that dry for a half hour or so, then I remove the tape and apply glue along the whole length of the joint.,
After that's dried for a while (1/2 hour to an hour, although you could even wait overnight), I dampen a q-tip with water and wipe it along the joint to remove excess white glue. Here you have to be very careful not to knock the railing off.
You can even go over the joint again with more thinned white glue, to strengthen the bond.
Sometimes, not always, I make a thinned wash of acrylic black or dark blue paint (whatever comes close to the basic color of the ship) and run that into the joint. It helps hide the shine from the white glue if there is any.
Here's an example from USS Enterprise I'm still working on. It's in 1:700 from Tamiya.
One helpful suggestion I found on another forum (I think it was http://www.modelshipgallery.com/index1.html) is to use lengths of railing no longer than two (2) inches. It makes them easier to handle. In the starboard photo above, the rail around the odd platform is one piece, then two straight pieces make up the rest of the walkway heading aft. I think I'd have failed miserably if I'd tried to do all that in one long piece.
Enterprise is only the second ship model I've used railings on. USS New Orleans was the first one, for the 2013 Pearl Harbor Group Build, so I'm really not all that experienced with the little devils. Sometimes they frustrate me to no end, and I think they're not worth the effort, but they do spruce up the look of the ship.
And one thing about white glue over superglue--you get to practice on the same kit. Any errors can be removed with water, and you can try again.