Created
June 20, 2012 06:36
-
-
Save sdepold/2958440 to your computer and use it in GitHub Desktop.
"virtual fields" in sequelize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Sequelize = require('sequelize') | |
var sequelize = new Sequelize('sequelize_test', 'root') | |
var Person = sequelize.define('Person', { | |
firstName: Sequelize.STRING, | |
lastName: Sequelize.STRING | |
}, { | |
instanceMethods: { | |
getFullName: function() { | |
return [this.firstName, this.lastName].join(' ') | |
} | |
} | |
}) | |
sequelize.sync().success(function() { | |
Person | |
.create({ firstName: 'Sascha', lastName: 'Depold' }) | |
.success(function(sdepold){ console.log(sdepold.getFullName()) }) | |
}) |
Author
sdepold
commented
Jun 21, 2012
via email
thanks!
Am Donnerstag, 21. Juni 2012 um 11:00 schrieb Pranil Dasika:
… Hello Sascha!
Done. Added https://gist.github.com/2964211 to the pull request.
Thanks,
Pranil
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2958440
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment