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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to