lib/paper_trail/serializers/yaml.rb in paper_trail-8.1.2 vs lib/paper_trail/serializers/yaml.rb in paper_trail-9.0.0

- old
+ new

@@ -1,18 +1,13 @@ +# frozen_string_literal: true + require "yaml" module PaperTrail module Serializers # The default serializer for, e.g. `versions.object`. module YAML - E_WHERE_OBJ_CHANGES = <<-STR.squish.freeze - where_object_changes has a known issue. When reading YAML from a text - column, it may return more records than expected. Instead of a warning, - this method may raise an error in the future. Please join the discussion - at https://github.com/airblade/paper_trail/pull/997 - STR - extend self # makes all instance methods become module methods as well def load(string) ::YAML.load string end @@ -27,16 +22,17 @@ 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(arel_field, field, value) - ::ActiveSupport::Deprecation.warn(E_WHERE_OBJ_CHANGES) - - # Need to check first (before) and secondary (after) fields - m1 = "%\n#{field}:\n- #{value}\n%" - m2 = "%\n#{field}:\n-%\n- #{value}\n%" - arel_field.matches(m1).or(arel_field.matches(m2)) + 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