I have a model (Candidate
) that I need to keep track of changes, version diffs, who changed it and any comments they had regarding the change. I love paper_trail and it is exactly what I need in almost every way, but I'm wondering what the best way to store "change comments" is. I've been thinking of implementing one of three options:
Add a
comments
column to myversions
table. If I went this way I'm not quite sure of the best way to actually update that information. Maybecandidate.version.comments = @comments
would work? Is it bad to add custom columns to paper_trail's table?Use paper_trail's metadata to store the comment. It doesn't seem like this was the intention for the metadata, but maybe it would work?
Add another table as
belongs_to :candidate
that would keep track of thecomments
andversion
. This seems gross - would I also need to have this new table belong to the versions table?
Any insight would be much appreciated. I've been pretty focused on finding a solution with paper_trail since I've used it before but I'd also consider other gems or options that you've used in the past.
I ended up going with option 1. I created a migration to add a comments field to the version table and added the following to
CandidatesController#update
It seems to be working great but I'd appreciate any other thoughts that you have!