Skip to content

Commit

Permalink
Fix serialization of audited_changes for inherited classes
Browse files Browse the repository at this point in the history
  • Loading branch information
amkisko committed Dec 12, 2024
1 parent 4fb4baf commit 47694f8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/audited/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,18 @@ def self.audited_classes
end

if Rails.gem_version >= Gem::Version.new("7.1")
def self.inherited(subclass)
super
subclass.serialize :audited_changes, coder: YAMLIfTextColumnType.new(subclass)
end

serialize :audited_changes, coder: YAMLIfTextColumnType.new(self)
else
def self.inherited(subclass)
super
subclass.serialize :audited_changes, YAMLIfTextColumnType.new(subclass)
end

serialize :audited_changes, YAMLIfTextColumnType.new(self)
end

Expand Down

0 comments on commit 47694f8

Please sign in to comment.