Open wesleycoder opened 6 years ago
I'm currently working on something like:
export class Player extends Model {
constructor (data) {
super(data)
if (!this.isSaved()) {
this.set('password', this._cryptPassword(this.get('password')))
}
}
//...
}
Is this a good way of doing it or using middlewares would be a better approach?
I'm struggling trying to get a clean solution for the create hook from previous version.
Before if we wanted to make any modification to the data before creating the instance on the model we could follow the example here but in this version it is not clear what should be the solution for it.
I've looked into the examples of middlewares here but could not understand how it should work.
I think the documentation on
Readme.md
should clarify this a little bit more.How could I make the same thing that the old docs describe since the
configure
method is not being called anymore?