I’m having an issue with Observers, and I’m hoping someone knows the
Here is the definition:
class VehicleObserver < ActiveRecord::Observer
It seems from reading AWDR that the last line may not be necessary
for Rails apps,
though it appears that if it isn’t there you can only specify when
take place via the observer command in Controllers. I want to observe
ALL saves to
Vehicle, not just ones generated via a controller. In fact, the vast
saves to Vehicle happen in a background process outside the web
My problem is that observations aren’t taking place.
I never hit the breakpoint line, which I assume means there’s no
observing at all.
I’d expect the observer to get invoked during unit tests. Is there
any reason to
P.S. I’m pretty sure I can just move this method into the model
itself and use the
hook interface, but I’m trying to understand observers and this
seems like a
good use of them.
– Tom M.