Skip to content

Commit

Permalink
update readme for disabling papertrail within initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
oehlschl committed Jan 2, 2019
1 parent 3e866d3 commit bfa05bf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,22 @@ Syntax example: (options described in detail later)

```ruby
# config/initializers/paper_trail.rb
PaperTrail.config.enabled = true
PaperTrail.config.has_paper_trail_defaults = {
on: %i[create update destroy]
}
PaperTrail.config.version_limit = 3
````

These options are intended to be set only once, during app initialization (eg.
in `config/initializers`). It is unsafe to change them while the app is running.
in `config/initializers` or in an environment-specific configuration file such as
`config/environments/test.rb`). It is unsafe to change them while the app is running.
In contrast, `PaperTrail.request` has various options that only apply to a
single HTTP request and thus are safe to use while the app is running.

Note that `PaperTrails.config.enabled` will be overwritten if it is set within
`config/initializers`. For more information, see
[Turning PaperTrail Off](#2d-turning-papertrail-off) below.

## 2. Limiting What is Versioned, and When

### 2.a. Choosing Lifecycle Events To Monitor
Expand Down Expand Up @@ -503,6 +507,11 @@ PaperTrail.enabled = false
**Do not use this in production** unless you have a good understanding of
threads vs. processes.
Also note that PaperTrail can only be disabled globally during or after
environment-specific initialization . In other words, changes to
`PaperTrail.enabled` (or its alias `PaperTrail.config.enabled`) in
`config/initializers` will be overwritten.
A legitimate use case is to speed up tests. See [Testing](#7-testing) below.
There is also a rails config option that does the same thing.
Expand Down

0 comments on commit bfa05bf

Please sign in to comment.