lundi 4 juillet 2022

previous_changes in rails after_update for an hash field not working

I am using rails 3 and for one of the use cases, I need to detect a change in a hash field. I am making changes to the f attribute which is a hash inside the hash attribute. Something like this: Table.field = {:e=> 'hello', :f=> {"new_field"=>"In progress"}} So when I make changes to new_field it's not reflecting in previous_changes method or changes method in after_update callback. I need to trigger a few events based on this. However, it always gives {}. I tried to replace the whole field with a different value and that change is detected. Is there any other method that we can use to detect hash changes?

Aucun commentaire:

Enregistrer un commentaire