Remove the plastic bed rails from the bed and take them outside or in a well-ventilated area where you can work.
Wipe the rails down with a wet cloth to remove dust and dirt.
Sand the rails thoroughly to remove the shiny coating on the plastic. Don't press too hard because you don't want to scratch the plastic.
Wipe the bed rails down with a wet cloth again to remove the debris.
Stand the rails upright and apply a coat of aerosol plastic paint primer. Hold the spray can 10 to 12 inches from the rail and spray back and forth all the way down the rail. Turn the rail around and spray the other side. Don't spray too close or your primer will run down the rail.
Allow the primer to dry overnight.
Apply a coat of acrylic latex paint to the bed rails. You can use a spray paint, but it may be better to use regular paint to avoid drips, since you'll be painting upright.
Allow the paint to dry overnight and then apply a second coat.