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

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.
24f3d4353d35f9b1e9b9de79605b3efc?d=identicon&s=25 rovnak (Guest)
on 2007-04-14 12:18
(Received via mailing list)
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.
8310c5a7c769345114597bcdef111488?d=identicon&s=25 Ben Munat (Guest)
on 2007-04-14 20:45
(Received via mailing list)
You mean like using the after_create and after_update callbacks instead?


This topic is locked and can not be replied to.