@@ -71,7 +71,7 @@ Model.encryptedAttributes = EncryptedAttributes(['secret'], {
71
71
// Pre-save hook: encrypt model attributes that need to be encrypted.
72
72
Model .pre (' save' , function (next ) {
73
73
try {
74
- this .encryptedAttributes .encryptAll (this )
74
+ Model .encryptedAttributes .encryptAll (this )
75
75
process .nextTick (next)
76
76
} catch (err) {
77
77
process .nextTick (next, err)
@@ -81,7 +81,7 @@ Model.pre('save', function (next) {
81
81
// Post-save hook: decrypt model attributes that need to be decrypted.
82
82
Model .post (' save' , function (next ) {
83
83
try {
84
- this .encryptedAttributes .decryptAll (this )
84
+ Model .encryptedAttributes .decryptAll (this )
85
85
process .nextTick (next)
86
86
} catch (err) {
87
87
process .nextTick (next, err)
@@ -91,7 +91,7 @@ Model.post('save', function (next) {
91
91
// Post-retrieve hook: ditto.
92
92
Model .post (' retrieve' , function (next ) {
93
93
try {
94
- this .encryptedAttributes .decryptAll (this )
94
+ Model .encryptedAttributes .decryptAll (this )
95
95
process .nextTick (next)
96
96
} catch (err) {
97
97
process .nextTick (next, err)
@@ -103,7 +103,7 @@ Model.post('retrieve', function (next) {
103
103
for (let attr of Model .encryptedAttributes .attributes ) {
104
104
Model .define (_ .camelCase (` encrypted ${ attr} ` ), function (val ) {
105
105
return Model .encryptedAttributes .encryptAttribute (this , val)
106
- }
106
+ })
107
107
}
108
108
```
109
109
0 commit comments