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.

Let observers create after_find if they need it

#676

Ticket #625 removed the line that caused observers to define an after_find method in the model if it didn't exist yet. This caused a speed-up (defining after_find can slow things down), but for cases where after_find is observed and not defined in the model, it means that an empty after_find must be explicitly defined in the model. It can be tricky to work out why an observer is failing due to this.

This patch restores the previous behavior, but only if the observer actually has an after_find defined. Hopefully, this offers the best of both worlds.

Reported by George Ogata · July 22nd, 2008 @ 10:19 PM

State: resolved
Milestone: 2.x
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Erik Peterson
    Erik Peterson

    This has been bothering me.

    +1

    July 25th, 2008 @ 07:04 PM

  2. Pratik
    Pratik
    • Assigned user set to Michael Koziarski

    July 26th, 2008 @ 03:20 PM

  3. Repository
    Repository
    • State changed from new to resolved

    (from [e8fc894f66daa7909d1790f2cd145844d256d282]) Make observers define #after_find in the model only if needed.

    [#676 state:resolved]

    Signed-off-by: Michael Koziarski

    http://github.com/rails/rails/co...

    July 26th, 2008 @ 03:26 PM

  4. Repository
    Repository

    (from [473d8d04624cb5e699759eb9d41d52f1323122dd]) Make observers define #after_find in the model only if needed.

    [#676 state:resolved] Signed-off-by: Michael Koziarski michael@koziarski.com http://github.com/rails/rails/co...

    August 25th, 2008 @ 09:28 AM