If I do the following:
@user.name = "John"
@user.url = "www.john.com"
@user.save
If I use after_save
@user.url = "www.johnseena.com"
@user.save
What will happen when I do this?
I believe it should save the value because of the ‘after_save’ callback.
In my opinion, if you call
savefunction in aafter_savecallback, then it will trap into a recursion unless you put a guard at the beginning. like thisHowever, apart from putting a guard, you can use
update_columnalsoIn this case it will not fire
after_save. However, it will fireafter_update. So if you have any update operation on that call back then you are in recursion again 🙂