Apply a small bead of urethane-based adhesive to the back of the ceiling medallion.
Pass the wires through the medallion (above).
Center the medallion on the pancake box and press. Fasten it with four 6d finishing nails driven into the joist.
Set the nailheads and fill with caulk or spackle.