Hi all -
I was thinking today (dangerous) and got to wondering if AR callbacks
know why there were called. That is, do they know what triggered them.
Say I have…
class Foo << AR::Base
before_destroy :bar
before_create :bar
def bar
# Can I determine if I am creating or destroying here?
end
end
Let’s assume for a moment that new_record? isn’t available as I know
that would catch the before_create one, but wouldn’t work for
before_save/after_save/etc…
I didn’t see anything in perusing the docs/source, but might have
missed it…
Anyone know?
-philip