Well, if your problem when building your rail is getting the pvc onto the wood, then what you gotta do is get some liquid nails, and lay it down alongside the edges of the PVC.
Then, to keep the pipes on for good, you use a drill bit and drill a hole diagonally at the end of your pvc through the bottom of the pipe (don't go through the top). Then just screw that shit in and you should be good.
Oh, and there is this HUGE thread that if you search "how to build a box and a rail" it would answer all your questions about building boxes and rails on your own. Actually, here is the thread, and my rail is exactly like this one except 14 feet long.
https://newschoolers.com/web/forums/readthread/thread_id/298747/