Suppose i have :
var resourceful = require("resourceful");
BaseTopic = function () {
this.string("name");
this.string("slug");
}
slugify = function (someString) {
// do some things here
}
Topic = resourceful.define("topic", BaseTopic);
Now, what i want is every time i save a new instance of Topic
the slug field gets updated, like this :
jsTopic = new Topic({name : "javascript"});
jsTopic.save(function (err, result) {
// in here slug field is defined
// so the slug field is saved to the db
console.log(result);
})
So the slug field is automatically filled, every time i make a new instance or saving it. Is that possible ?