Skip to content

Commit e78693f

Browse files
committed
Fix sample thinky code
1 parent a752eb0 commit e78693f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Model.encryptedAttributes = EncryptedAttributes(['secret'], {
7171
// Pre-save hook: encrypt model attributes that need to be encrypted.
7272
Model.pre('save', function (next) {
7373
try {
74-
this.encryptedAttributes.encryptAll(this)
74+
Model.encryptedAttributes.encryptAll(this)
7575
process.nextTick(next)
7676
} catch (err) {
7777
process.nextTick(next, err)
@@ -81,7 +81,7 @@ Model.pre('save', function (next) {
8181
// Post-save hook: decrypt model attributes that need to be decrypted.
8282
Model.post('save', function (next) {
8383
try {
84-
this.encryptedAttributes.decryptAll(this)
84+
Model.encryptedAttributes.decryptAll(this)
8585
process.nextTick(next)
8686
} catch (err) {
8787
process.nextTick(next, err)
@@ -91,7 +91,7 @@ Model.post('save', function (next) {
9191
// Post-retrieve hook: ditto.
9292
Model.post('retrieve', function (next) {
9393
try {
94-
this.encryptedAttributes.decryptAll(this)
94+
Model.encryptedAttributes.decryptAll(this)
9595
process.nextTick(next)
9696
} catch (err) {
9797
process.nextTick(next, err)
@@ -103,7 +103,7 @@ Model.post('retrieve', function (next) {
103103
for (let attr of Model.encryptedAttributes.attributes) {
104104
Model.define(_.camelCase(`encrypted ${attr}`), function (val) {
105105
return Model.encryptedAttributes.encryptAttribute(this, val)
106-
}
106+
})
107107
}
108108
```
109109

0 commit comments

Comments
 (0)