Wednesday, 2 October 2013

how to check if attribute changed while using callback after_commit. changed? method not working

how to check if attribute changed while using callback after_commit.
changed? method not working

I am using callback "after_commit" and in that i am using rails "changed?"
method to know if some attributes value changed. I read the documentation
it seems that "changed? and "_was" methods are not supported in after
commit callback its supported in after_save but i dont want to use that.
def some_function
if some_attributes_value_changed?
previous_value = some_attributes_value_was
end
end
What is the alternate to these methods to know if value changed after
database updated.

No comments:

Post a Comment