From fcc9eafec0af7022cf6ced2f71334a39d84eacbd Mon Sep 17 00:00:00 2001 From: Amit Chakradeo Date: Mon, 4 Dec 2023 10:32:57 -0800 Subject: [PATCH 1/2] Change the type of user_id and record_id to string so UUID keys work! --- db/migrate/20190527035005_create_audit_logs.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20190527035005_create_audit_logs.rb b/db/migrate/20190527035005_create_audit_logs.rb index 7944a51..a258df4 100644 --- a/db/migrate/20190527035005_create_audit_logs.rb +++ b/db/migrate/20190527035005_create_audit_logs.rb @@ -4,8 +4,8 @@ class CreateAuditLogs < ActiveRecord::Migration[5.2] def change create_table "audit_logs", force: :cascade do |t| t.string "action", null: false - t.bigint "user_id" - t.bigint "record_id" + t.string "user_id" + t.string "record_id" t.string "record_type" t.text "payload" t.text "request" From c49f207620ae28f2a52e17bb4e2671ca69d03e6d Mon Sep 17 00:00:00 2001 From: Amit Chakradeo Date: Sat, 14 Sep 2024 19:01:52 -0700 Subject: [PATCH 2/2] Add coder argument to serialize --- lib/audit-log/model.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/audit-log/model.rb b/lib/audit-log/model.rb index cf461f8..48f7d41 100644 --- a/lib/audit-log/model.rb +++ b/lib/audit-log/model.rb @@ -7,8 +7,8 @@ module Model included do self.table_name = AuditLog.config.table_name - serialize :payload, JSON - serialize :request, JSON + serialize :payload, coder: JSON + serialize :request, coder: JSON belongs_to :user, class_name: AuditLog.config.user_class, required: false belongs_to :record, polymorphic: true, required: false