Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit c6b0e9b1172861f0e69f6c0f79e455bb0a77c608 1 parent 0bcd864
Ned Schwartz authored March 20, 2012

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  src/backbone-forms.js
2  src/backbone-forms.js
@@ -339,7 +339,7 @@
339 339
340 340
         if (_.isFunction(model.schema)) return model.schema();
341 341
-        return model.schema;
+        return (model.schema) ? model.schema : {};
343 343
344 344
345 345
       //Handle other options

3 notes on commit c6b0e9b

Charles Davison

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?

Ned Schwartz
Charles Davison

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.
Something went wrong with that request. Please try again.