You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to limited volunteers, issues that do not follow these instructions will be
closed without comment.
Check the following boxes:
This is not a usage question, this is a bug report
This bug can be reproduced with the script I provide below
This bug can be reproduced in the latest release of the paper_trail gem
Due to limited volunteers, we cannot answer usage questions. Please ask such
questions on StackOverflow.
Bug reports must use the following template:
# frozen_string_literal: true# Use this template to report PaperTrail bugs.# Please include only the minimum code necessary to reproduce your issue.require"bundler/inline"# STEP ONE: What versions are you using?gemfile(true)doruby"3.3.5"source"https://rubygems.org"gem"activerecord","~> 7.2"gem"minitest"gem"paper_trail",require: falsegem"sqlite3"endrequire"active_record"require"minitest/autorun"require"logger"# Please use sqlite for your bug reports, if possible.ActiveRecord::Base.establish_connection(adapter: "sqlite3",database: ":memory:")ActiveRecord::Base.logger=nilActiveRecord::Schema.definedo# STEP TWO: Define your tables here.create_table:users,force: truedo |t|
t.binary:key,null: falset.timestampsnull: falseendcreate_table:versionsdo |t|
t.string:item_type,null: falset.integer:item_id,null: falset.string:event,null: falset.string:whodunnitt.text:object,limit: 1_073_741_823t.text:object_changes,limit: 1_073_741_823t.datetime:created_atendadd_index:versions,%i[item_typeitem_id]endActiveRecord::Base.logger=Logger.new(STDOUT)require"paper_trail"# STEP FOUR: Define your AR models here.classUser < ActiveRecord::Basehas_paper_trailendPaperTrail.serializer=PaperTrail::Serializers::JSON# STEP FIVE: Please write a test that demonstrates your issue.classBugTest < ActiveSupport::TestCasedeftest_1assert_difference(->{PaperTrail::Version.count}, +1){User.create(key: SecureRandom.random_bytes)}endend# STEP SIX: Run this script using `ruby my_bug_report.rb`
Additional Inputs
The error is the following:
JSON::GeneratorError: source sequence is illegal/malformed utf-8
I see in the bug reports one mention in the past of someone who stumbled into the same issue but it was closed because the reporter could simply skip the binary columns.
I may be wrong but I feel this is a real use case: a user may want to reify a version of a record which contain some binary data. That's why I was a bit surprised that the object and object_changes serialization in JSON does not base64 automatically such binary data.
Is there any limitation preventing to handle that case out-of-the box?
Thanks in adavnce for your help,
The text was updated successfully, but these errors were encountered:
Thank you for your contribution!
Due to limited volunteers, issues that do not follow these instructions will be
closed without comment.
Check the following boxes:
paper_trail
gemDue to limited volunteers, we cannot answer usage questions. Please ask such
questions on StackOverflow.
Bug reports must use the following template:
Additional Inputs
The error is the following:
I see in the bug reports one mention in the past of someone who stumbled into the same issue but it was closed because the reporter could simply skip the binary columns.
I may be wrong but I feel this is a real use case: a user may want to reify a version of a record which contain some binary data. That's why I was a bit surprised that the
object
andobject_changes
serialization in JSON does not base64 automatically such binary data.Is there any limitation preventing to handle that case out-of-the box?
Thanks in adavnce for your help,
The text was updated successfully, but these errors were encountered: