Sha256: 10d857ac6b2290e51832c8851fe9ffd9d092b49612da54a9dc392aa1d8d22af5
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require "yaml" module PaperTrail module Serializers # The default serializer for, e.g. `versions.object`. module YAML extend self # makes all instance methods become module methods as well def load(string) ::YAML.load string end def dump(object) ::YAML.dump object end # Returns a SQL LIKE condition to be used to match the given field and # value in the serialized object. def where_object_condition(arel_field, field, value) arel_field.matches("%\n#{field}: #{value}\n%") end # Returns a SQL LIKE condition to be used to match the given field and # value in the serialized `object_changes`. def where_object_changes_condition(*) raise <<-STR.squish.freeze where_object_changes no longer supports reading YAML from a text column. The old implementation was inaccurate, returning more records than you wanted. This feature was deprecated in 8.1.0 and removed in 9.0.0. The json and jsonb datatypes are still supported. See discussion at https://github.com/airblade/paper_trail/pull/997 STR end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paper_trail-9.0.1 | lib/paper_trail/serializers/yaml.rb |
paper_trail-9.0.0 | lib/paper_trail/serializers/yaml.rb |