Permalink
Browse files

make defining the schema of sub-models optional by not erroring if th…

…e schema attribute is not defined on the model - instead return an empty object as the schema
  • Loading branch information...
1 parent 0bcd864 commit c6b0e9b1172861f0e69f6c0f79e455bb0a77c608 @theinterned committed Mar 20, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/backbone-forms.js
View
2 src/backbone-forms.js
@@ -339,7 +339,7 @@
if (_.isFunction(model.schema)) return model.schema();
- return model.schema;
+ return (model.schema) ? model.schema : {};
})();
//Handle other options

3 comments on commit c6b0e9b

@powmedia

Thanks for the pull request but this doesn't seem to fix the problem - removing the subSchema from the 'UI Test' section in test/index.html still produces the error. May need some more changes to fix. I'm also not sure that removing this error is the best approach because the editor is pretty useless without a subSchema.

What use case do you have for not including a subSchema?

@theinterned
@powmedia

Fair point, I suppose it's not worth interrupting a long running process with an error. If you can amend the code with a unit test specific to this situation and so that the UI test passes if the subSchema is removed, I'll merge this pull request.

Please sign in to comment.