I have the following models

SupportedOperatingSystem [intersection entity]

An Installer can have many OperatingSystems, the operating systems that it supports are maintained in SupportedOperatingSystem model. It is required that and Installer be associated with at least 1 OperatingSystem.

validation code in Installer model
   def validate
 	if self.operating_systems.empty?
 	  errors.add_to_base('You must select at least one Operating System')
So lets say I've created an Installer model and associated various operating systems with it. Now I want to edit the Installer model. In my form, I'm displaying all the available operating systems via checkboxes.

[x]os1 [ ]os2 [ ]os3

os1 is checked because when I created the Installer model I associated it with os1. So now I uncheck os1 and click "update." I get an error message as expected "You must select at least one Operating System." But, if I check the "supported_operating_systems" table, this association has been deleted, even though the validation failed. This is bad, because if the user decides to close their browser then the Installer model will be left in an invalid state. Is there a way to prevent this? Why is the record being deleted even though validation does not succeed?