PaperTrail 2.2.7-2.4.0 Changes
1. Changeset
From PaperTrail 2.2.7 release you can find a new method of Version instances, called changeset. PaperTrail doesn’t have diffs mechanism inside, but now if you have object_changes column in versions table (it can be generated automatically if you install PaperTrail with –with-changes option) it will store Rails’ changes of dirty objects.
1 2 |
|
1 2 3 4 |
|
More information about Diffing Versions you can find in PaperTrail README on GitHub.
2. Flexibility in naming of methods
There are some situations when methods version and versions are already busy by other associations or smth. In this case we can change the names of these methods in our application (but sometimes it’s time-consuming) or we can configure these methods in PaperTrail like that:
1 2 |
|
3. Add :on option
With this option we can configure what events we need to track. For example, we don’t need to track create events:
1
|
|
4. Without Versioning
In some cases some action/actions must be executed without versioning. Now PaperTrail has simple wrapper for this case:
1 2 3 4 5 6 7 8 |
|
Usage:
1 2 3 4 5 6 7 |
|
5. Attr Accessible
Now we need to use attr_accessible if we want to store some meta info in versions table. Example of meta information from PaperTrail README:
1 2 3 4 5 6 7 8 9 |
|
In this case author_id, word_count and answer are meta, and we need to have these columns in versions table. And also we need to add these attrs to attr_accessible