Skip to content

Commit

Permalink
Fix by changing the nested property to class
Browse files Browse the repository at this point in the history
  • Loading branch information
lukejagodzinski committed Oct 28, 2015
1 parent 6d2e664 commit 03b4de1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/module/get_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ methods.getValidationErrors = function() {
var fields = Class.getFields();
_.each(fields, function(field, fieldName) {
if (
doc[fieldName] && field instanceof Astro.fields.object && field.nested
doc[fieldName] && field instanceof Astro.fields.object && field.class
) {
var nestedErrors = doc[fieldName].getValidationErrors();
_.each(nestedErrors, function(nestedError, nestedFieldName) {
errors[fieldName + '.' + nestedFieldName] = nestedError;
});
} else if (
doc[fieldName] && field instanceof Astro.fields.array && field.nested
doc[fieldName] && field instanceof Astro.fields.array && field.class
) {
_.each(doc[fieldName], function(nestedDoc, index) {
if (nestedDoc instanceof Astro.BaseClass) {
Expand Down Expand Up @@ -81,11 +81,11 @@ methods.clearValidationErrors = function() {
var fields = Class.getFields();
_.each(fields, function(field, fieldName) {
if (
doc[fieldName] && field instanceof Astro.fields.object && field.nested
doc[fieldName] && field instanceof Astro.fields.object && field.class
) {
doc[fieldName]._errors.clear();
} else if (
doc[fieldName] && field instanceof Astro.fields.array && field.nested
doc[fieldName] && field instanceof Astro.fields.array && field.class
) {
_.each(doc[fieldName], function(nestedDoc, index) {
if (nestedDoc instanceof Astro.BaseClass) {
Expand Down

0 comments on commit 03b4de1

Please sign in to comment.