Fix serialized attributes always being saved

Fixes #8328.  Models with serialized attributes will only be saved if the record has changed.

Uses #hash to compare original serialize attribute value to current value.  Similar to #13428

Chose to use #hash for comparison for performance reasons.  The downside of using #hash rather than #deep_dup is that serialized_attribute_was will not be stored, and will return nil.