Bug #446 fixed

parent e58cd715
Showing with 9 additions and 0 deletions
...@@ -47,6 +47,9 @@ module.exports = { ...@@ -47,6 +47,9 @@ module.exports = {
toJSON: function () { toJSON: function () {
var stuPicto = this.toObject(); var stuPicto = this.toObject();
if (typeof stuPicto.attributes !== 'object') {
stuPicto.attributes = JSON.parse(stuPicto.attributes);
}
stuPicto.attributes = StuPicto.getValidAttributes(stuPicto.attributes); stuPicto.attributes = StuPicto.getValidAttributes(stuPicto.attributes);
return stuPicto; return stuPicto;
} }
...@@ -132,6 +135,9 @@ module.exports = { ...@@ -132,6 +135,9 @@ module.exports = {
* to the function if necesary) * to the function if necesary)
*/ */
beforeCreate: function (attrs, next) { beforeCreate: function (attrs, next) {
if (typeof attrs.attributes !== 'object') {
attrs.attributes = JSON.parse(attrs.attributes);
}
attrs.attributes = StuPicto.getValidAttributes(attrs.attributes); attrs.attributes = StuPicto.getValidAttributes(attrs.attributes);
next(); next();
}, },
...@@ -144,6 +150,9 @@ module.exports = { ...@@ -144,6 +150,9 @@ module.exports = {
* to the function if necesary) * to the function if necesary)
*/ */
beforeUpdate: function (attrs, next) { beforeUpdate: function (attrs, next) {
if (typeof attrs.attributes !== 'object') {
attrs.attributes = JSON.parse(attrs.attributes);
}
attrs.attributes = StuPicto.getValidAttributes(attrs.attributes); attrs.attributes = StuPicto.getValidAttributes(attrs.attributes);
next(); 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