tarlepp / angular-sailsjs-boilerplate

'Boilerplate' for AngularJS + Sails.js
MIT License
307 stars 87 forks source link

addDataCreate doesn't work with populated data #104

Open beaverusiv opened 8 years ago

beaverusiv commented 8 years ago

The policies addDataCreate and addDataUpdate are meant to be run on routes that save data to automatically set and update createdUser and updatedUser fields but this doesn't work if you're saving populated data, e.g. saving a role and permissions it has a relationship to in one call like so:

role: {
id: 1
permissions: [{ id:1, writeable: true}, {id:2, writeable: false}],
name: 'Admin'
}

If this was working properly we would see each of the permissions getting these fields added, not just the role. Is this possible in an automatic way?