Displaying 1 result from an estimated 1 matches for "allergy_list".
2006 Mar 05
2
Need help understanding Rails magic!
...to see if it had been deselected. If it had, I''d delete the associated allergy record
# I assumed the code below would destroy *all* the allergy records. In fact, it only destroys the
# ones that had been deselected. How the heck is THAT happening ?!?!?!?
######
@allergy_list = Allergy.find(:all,
:conditions => ["emrec_id = ?", @emrec.id])
@allergy_list.each do |allergy|
allergy.destroy
end
######
# now add any new items. the model as a
# validate_uniqueness_of condition on description
# to avoid duplicate...