Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you really much for PaperTrail.
I ran into a bug while using PaperTrail in a specific way:
t.string :whodunnit
I havet.references :whodunnit, foreign_key: {to_table: :users}
I really loved that this worked out of the box.
But I eventually ran into a weird behavior:
PaperTrail.request.whodunnit
is an instance of aUser
PaperTrail.request(whodunnit:)
with a blockPaperTrail.request.whodunnit
is a dup (new record) of the initial user instance.This is particularly bad when creating another version right after because that new
User
dup will now be saved and duplicated.I did my best to add a test to highlight the problem with a new test. I understand that using an AR model as whodunnit value is not necessarily supported, but the proposed changed should not break the API.
Thank you
Check the following boxes:
master
(if not - rebase it).Added an entry to the Changelog if the newcode introduces user-observable changes.
and description in grammatically correct, complete sentences.