I am trying to detect changes in a hash attribute in my model. But I am not able to detect changes because it is serialized. I am trying to detect changes after_commit callback.
Here is the code //
settings.rb
serialize :additional_settings, Hash after_commit :publish_to_central
def publish_to_central if self.previous_changes.present? account.model_changes = self.previous_changes.to_hash end end
after updating the additional_settings hash, the value gets updated but self.previous_changes returns empty.
I am not able to detect changes only for serialized hash and array attributes, remaining works fine. Can anyone help with this.
Aucun commentaire:
Enregistrer un commentaire