Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger defaultValue when data value is undefined (not set) #611

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npm install orm

## Node.js Version Support

Tests are done using [Travis CI](https://travis-ci.org/) for node versions `0.6.x`, `0.8.x` and `0.10.x`. If you want you can run
Tests are done using [Travis CI](https://travis-ci.org/) for node versions `0.8.x` and `0.10.x`. If you want you can run
tests locally.

```sh
Expand Down
3 changes: 2 additions & 1 deletion lib/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ function Instance(Model, opts) {
// If someone complains about noise, we know it does something, and figure it out then.
if (instance.hasOwnProperty(key)) console.log("Overwriting instance property");

if (key in opts.data) {
//Undefined data values are not setted so skip to defaultvalue
if (opts.data[key] !== undefined) {
defaultValue = opts.data[key];
} else if (prop && 'defaultValue' in prop) {
defaultValue = prop.defaultValue;
Expand Down