Delete all with has_many


Im not sure using :dependent => delete_all is correct here but I want
to delete all the ApptEdits when an Appointment is updated in a
certain situation. so i have:


and then i want to do something like:


but this does not work. i was thinking about something like
using :dependent => :delete_all, but i only want to do this after a
specific update_attributes call and not every one so i dont think this
is appropriate. what is the best way to write the equivalent to the
pseudocode: @appt_to_edit.appt_edits.destroy?



MaurĂ­cio Linhares (pt-br) |