postlight / lux

Build scalable, Node.js-powered REST JSON APIs with almost no code.
https://lux.postlight.com
MIT License
570 stars 60 forks source link

Attribute added in `beforeCreate` hook not serialized into payload #725

Open nickschot opened 7 years ago

nickschot commented 7 years ago

When using the beforeCreate (and probably some of the other hooks too) to set a model attribute which is not set by the request, it is not serialized/returned in the payload/response.

Changing attributes which already exist in the request in the same way works fine.

jamemackson commented 7 years ago

I am doing something similar to this where I will set the id attribute in beforeCreate and beforeUpdate and haven't had any trouble with this.