Skip any changed attributes marked to skip in the PaperTrail options #236
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.
I came across the same problem described in #224 when using paper_trail with acts-as-taggable-on, and have a (partial) solution.
The reason this happens is that acts-as-taggable-on defines some code that manually adds a non-database field to the
changed_attributes
collection. paper_trail then tries to assign this value directly to the record using the column accessor, resulting in the following error:My solution to this is to exclude from
changed_attributes
any keys defined in the:skip
options of paper_trail - identically to what happens soon after that in the process, when the object is serialised. The reason this is just a partial fix is that thetag_list
attribute still needs to be specified in the "skip" options for paper_trail. I don't really see a way around this short of acts-as-taggable-on changing how it behaves, but I'm very open to any suggestions.