Skip to content

Commit 3cc736e

Browse files
authored
Document version_error_behavior options (#1516)
1 parent 29d6013 commit 3cc736e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Choose version:
6969
- [6.b. Custom Serializer](#6b-custom-serializer)
7070
- [6.c. Custom Object Changes](#6c-custom-object-changes)
7171
- [6.d. Excluding the Object Column](#6d-excluding-the-object-column)
72+
- [6.e. Error handling](#6e-error-handling)
7273
- [7. Testing](#7-testing)
7374
- [7.a. Minitest](#7a-minitest)
7475
- [7.b. RSpec](#7b-rspec)
@@ -1450,6 +1451,18 @@ The `object` column ends up storing a lot of duplicate data if you have models t
14501451
and that are updated many times. You can save ~50% of storage space by removing the column from the
14511452
versions table. It's important to note that this will disable `reify` and `where_object`.
14521453

1454+
### 6.e. Error handling
1455+
1456+
You can change the behavior of error handling when an exception is raised while creating a version, by setting the `version_error_behavior` option:
1457+
1458+
```ruby
1459+
# config/initializers/paper_trail.rb
1460+
PaperTrail.config.version_error_behavior = :legacy # (Default) Raise on create, log on update/delete.
1461+
PaperTrail.config.version_error_behavior = :log # Only log error.
1462+
PaperTrail.config.version_error_behavior = :exception # Raise exception.
1463+
PaperTrail.config.version_error_behavior = :silent # No-op.
1464+
```
1465+
14531466
## 7. Testing
14541467

14551468
You may want to turn PaperTrail off to speed up your tests. See [Turning

0 commit comments

Comments
 (0)