Sha256: 5b4d2f5c470900d46fb49dcc588c21a050edb2af4bc2a68021360b191c66a4d6
Contents?: true
Size: 378 Bytes
Versions: 3
Compression:
Stored size: 378 Bytes
Contents
# This custom serializer excludes nil values module CustomJsonSerializer extend PaperTrail::Serializers::Json def self.load(string) parsed_value = super(string) parsed_value.is_a?(Hash) ? parsed_value.reject { |k,v| k.blank? || v.blank? } : parsed_value end def self.dump(object) object.is_a?(Hash) ? super(object.reject { |k,v| v.nil? }) : super end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
paper_trail_without_deprecated-3.0.0.beta1 | test/custom_json_serializer.rb |
paper_trail-3.0.0.beta1 | test/custom_json_serializer.rb |
paper_trail-2.7.2 | test/custom_json_serializer.rb |