The diode you have drawn is not required. The diode across the coil you forgot to draw is the critical one. I'd also recommend you put the opto between the relay and GND rather than between the relay and +24, although it should be O.K. where it is. By the way, if you are only dealing with +24V, why use an opto to drive the relay? A far cheaper transistor or FET would easily do the job.