Forum: Radiant CMS Observers in extensions

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.
Bdf2290f0b1d87cb0853966e7e51606b?d=identicon&s=25 Andrew O'Brien (Guest)
on 2007-06-05 21:19
(Received via mailing list)
Is there a good way to add an ActiveRecord observer through and
extension's activate method?  I'm guessing the standard way (adding it
to the config in environment.rb) won't work since the extension hasn't
loaded yet.

8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-06-05 22:36
(Received via mailing list)

You might be able to just 'mention' the class in the activate method so
it gets loaded.  Then your observer would have to have an "observe" call
in its class.  Not sure if that will actually work, but it's worth a

Bdf2290f0b1d87cb0853966e7e51606b?d=identicon&s=25 Andrew O'Brien (Guest)
on 2007-06-05 23:00
(Received via mailing list)
Hi Sean,

It, looks like calling the (observer).instance method in activate does
the trick.  I'm also mentioning it at the end of the two classes I'm
observing, so that could be doing it as well -- haven't tried figuring
out which is responsible yet.

I think my problem is actually related to the fact that the observer
doesn't seem to get notified when the join table in a HABTM
relationship gets changed -- only when one of the two actual models
does.  I haven't completely confirmed that yet, but that's what it's
looking like.  That's a more general Rails question I guess, but
anyone ever tackled that before?

This topic is locked and can not be replied to.