File: custom_object_changes_adapter.rb

package info (click to toggle)
ruby-paper-trail 12.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,200 kB
  • sloc: ruby: 6,743; makefile: 6
file content (20 lines) | stat: -rw-r--r-- 377 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

# This custom serializer excludes nil values
class CustomObjectChangesAdapter
  def diff(changes)
    changes
  end

  def load_changeset(version)
    version.changeset
  end

  def where_object_changes(klass, attributes)
    klass.where(attributes)
  end

  def where_object_changes_from(klass, attributes)
    klass.where(attributes)
  end
end