Forum: Ruby on Rails distinguishing "update or create context" from within after_

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
rovnak (Guest)
on 2007-04-14 14:18
(Received via mailing list)
Hi,
Of course, I like the callbacks in active record. However, it seems
that it would be valuable to be able to distinguish whether an
after_save is being invoked as part of a create as opposed to part of
an update scenario.

Is there a best practice for doing this? I assume I can set a flag int
he create or update methods and check in the after_save, but not sure
if this is best practice.
Ben M. (Guest)
on 2007-04-14 22:45
(Received via mailing list)
You mean like using the after_create and after_update callbacks instead?

:-)

b
This topic is locked and can not be replied to.