mercredi 28 décembre 2016

Determine if a serialized hash has changed in active record.

What would the best way to determine if a hash has changed, normally there's changes, and changed method but it's hard to pinpoint if you are only concerned for the hash changes.

For example

class Person
   attr_accessible : name

   serialize :actions, Hash
end

with this, the hash actions can do many things such as actions[:eat], actions[:work][:something_else]

The problem with this is that for a specific use case, I'm only concerned for the actions if it has changed, so the methods changes, and changed can't be that reliable.

Aucun commentaire:

Enregistrer un commentaire