Refactoring the serializers to be modules instead of classes, since they never get instantiated.
This commit is contained in:
parent
afa58117f5
commit
05301e586e
|
@ -749,7 +749,7 @@ By default, PaperTrail stores your changes as a YAML dump. You can override this
|
|||
>> PaperTrail.config.serializer = MyCustomSerializer
|
||||
```
|
||||
|
||||
The serializer needs to be a class that has a `load` and `dump` class method. These serializers are included in the gem for your convenience:
|
||||
A valid serializer is a `module` (or `class`) that defines a `load` and `dump` method. These serializers are included in the gem for your convenience:
|
||||
|
||||
* [Yaml](https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/serializers/yaml.rb) - Default
|
||||
* [Json](https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/serializers/json.rb)
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'active_support/json'
|
|||
|
||||
module PaperTrail
|
||||
module Serializers
|
||||
class Json
|
||||
module Json
|
||||
def self.load(string)
|
||||
ActiveSupport::JSON.decode string
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'yaml'
|
|||
|
||||
module PaperTrail
|
||||
module Serializers
|
||||
class Yaml
|
||||
module Yaml
|
||||
def self.load(string)
|
||||
YAML.load string
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue