that'd be the usual way, or if you don't like the nut ends sticking out, drill a shallow coutersink on the nut side so they're flush - or you could use lag bolts that don't go right thru - or if ya wanna get fancy, you could notch the stakes and inset the rail boards, use countersunk screws and cap them with wood plugs .... or if it's all show and no go, you could use velcro

Bill