Delete all with has_many


#1

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:

@appt_to_edit.update_attributes(appointment_info)

and then i want to do something like:

@appt_to_edit.appt_edits.destroy

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?


#2

@appt_to_edit.appt_edits.destroy_all

MaurĂ­cio Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)