Skip to content
Open
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
6 changes: 5 additions & 1 deletion lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ Loader.prototype.prepFixtureData = function(data, Model) {
if (Model.attributes.hasOwnProperty(key)) {
result[key] = val;
} else {
console.warn('attribute "' + key +"' not defined on model '" + Model.name + "'.");
if (self.options.throwErrorOnUndefinedAttribute === true) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest: errorOnUndefinedAttribute.

Also, if (self.options.throwErrorOnUndefinedAttribute) is sufficient... anything truthy should be OK.

throw new Error('attribute "' + key +"' not defined on model '" + Model.name + "'.");
} else {
log.warn('attribute "' + key +"' not defined on model '" + Model.name + "'.");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually be log() ... log is expected to be just a plain function

}
}
}
});
Expand Down