Adjust language in README for abstract class declaration; rename key assignment appropriately for PaperTrail.enabled_for_model
This commit is contained in:
parent
5302f5ecc8
commit
12a9ca9b31
|
@ -553,7 +553,7 @@ Alternatively you could store certain metadata for one type of version, and othe
|
|||
|
||||
If you only use custom version classes and don't use PaperTrail's built-in one, on Rails `>= 3.2` you must:
|
||||
|
||||
- either declare PaperTrail's version class abstract like this (in `config/initializers/paper_trail_patch.rb`):
|
||||
- either declare the `PaperTrail::Version` class to be abstract like this (in an initializer):
|
||||
|
||||
```ruby
|
||||
PaperTrail::Version.module_eval do
|
||||
|
|
|
@ -34,12 +34,12 @@ module PaperTrail
|
|||
|
||||
# Sets whether PaperTrail is enabled or disabled for this model in the current request.
|
||||
def self.enabled_for_model(model, value)
|
||||
paper_trail_store[:"request_enabled_for_#{model}"] = value
|
||||
paper_trail_store[:"enabled_for_#{model}"] = value
|
||||
end
|
||||
|
||||
# Returns `true` if PaperTrail is enabled for this model in the current request, `false` otherwise.
|
||||
def self.enabled_for_model?(model)
|
||||
!!paper_trail_store.fetch(:"request_enabled_for_#{model}", true)
|
||||
!!paper_trail_store.fetch(:"enabled_for_#{model}", true)
|
||||
end
|
||||
|
||||
# Set the field which records when a version was created.
|
||||
|
|
Loading…
Reference in New Issue