Bug #446 fixed

parent e58cd715
Showing with 9 additions and 0 deletions
......@@ -47,6 +47,9 @@ module.exports = {
toJSON: function () {
var stuPicto = this.toObject();
if (typeof stuPicto.attributes !== 'object') {
stuPicto.attributes = JSON.parse(stuPicto.attributes);
}
stuPicto.attributes = StuPicto.getValidAttributes(stuPicto.attributes);
return stuPicto;
}
......@@ -132,6 +135,9 @@ module.exports = {
* to the function if necesary)
*/
beforeCreate: function (attrs, next) {
if (typeof attrs.attributes !== 'object') {
attrs.attributes = JSON.parse(attrs.attributes);
}
attrs.attributes = StuPicto.getValidAttributes(attrs.attributes);
next();
},
......@@ -144,6 +150,9 @@ module.exports = {
* to the function if necesary)
*/
beforeUpdate: function (attrs, next) {
if (typeof attrs.attributes !== 'object') {
attrs.attributes = JSON.parse(attrs.attributes);
}
attrs.attributes = StuPicto.getValidAttributes(attrs.attributes);
next();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment