ActiveRecord use to call after_save callback each time save method is called even if the model was not changed and no insert/update query spawned.
This is the default behaviour actually. And that is ok in most cases.
But some of the after_save callbacks are sensitive to the thing that if the model was actually saved or not.
Is there a way to determine if the model was actually saved in the after_save?
I am running the following test code:
class Stage < ActiveRecord::Base
after_save do
pp changes
end
end
s = Stage.first
s.name = "q1"
s.save!