Forum: Ruby on Rails delete all with has_many

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
David (Guest)
on 2009-02-27 08:59
(Received via mailing list)
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 L. (Guest)
on 2009-02-27 13:12
(Received via mailing list)

Maurício Linhares (pt-br) |
This topic is locked and can not be replied to.