This project is archived and is in readonly mode.

#3277 ✓stale
Lawrence Pit

+before_create+, +after_create+, +before_destroy+ and +after_destroy+ callbacks for AR collection associations

Reported by Lawrence Pit | September 27th, 2009 @ 07:19 AM

I have a need to log / audit changes to has_many and has_and_belongs_to_many records. Especially has_and_belongs_to_many associations are currently hard to audit because when the owner is new the after_add/after_remove callbacks are called before the owner is actually saved to the database. Also, with the relatively new :autosave option for AR associations the same issue occurs.

This patch adds the ability to define +before_create+, +after_create+, +before_destroy+ and +after_destroy+ callbacks on AR collection associations. The patch is made against 2-3-stable.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages