lundi 30 décembre 2019

previous_changes does not list the hash changes in ruby

I have a hash column in my table when I change the value of particular hash the changes doesn't list in previous_changes. Can anyone help with this..

But the value gets updated in the table. It happens only for the hash attributes, others works fine. For an example, settings table.

additional_settings column which is of type hash. When I tried changing a key-value pair, e.g.

settings.additional_settings[:key] = "some_value"

The changes does not listed in self.previous_changes

Here is the code in settings.rb,

if self.previous_changes.present? =>(true because of changes in "updated_at" attribute)
  model_changes = self.previous_changes  => (here the change made in hash is not listed)
end

Aucun commentaire:

Enregistrer un commentaire