Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Add support for before and after add/remove callbacks to belongs_to associations

#1564

belongs_to currently does not support before/after_add/remove callbacks as has_many does. There are a variety of applications in which this is beneficial. I found an original ticket from a few years ago but it only implemented the before/after_add callbacks and did not apply cleanly any more.

I've reworked the existing patch from the link below to support all necessary callbacks including before_add, before_remove, after_add, and after_remove. More information on the original request can be found on the ticket here:

http://dev.rubyonrails.org/ticke...

Thanks!

  • sob

Reported by sob · December 12th, 2008 @ 05:32 AM

State: new
Milestone: 3.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. sob
    sob
    • Assigned user set to Jeremy Kemper
    • Tag changed from belongs_to, callbacks to belongs_to, callbacks, pa, patch

    December 12th, 2008 @ 11:50 PM

  2. Pratik
    Pratik
    • Assigned user changed from Jeremy Kemper to Pratik

    March 8th, 2009 @ 12:50 PM

  3. Trek
    Trek

    +1 for this (although I imagine it won't apply cleanly anymore).

    April 13th, 2010 @ 11:55 PM

  4. joel (at developwithstyle)
    joel (at developwithstyle)
    1. Surprised it's not already in!

    May 4th, 2010 @ 12:17 PM

  5. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  6. bingbing