backbone-forms
backbone-forms copied to clipboard
Allow a NestedModel's model attribute to be specified as a string or an object
I struggled for a while trying to get NestedModels to work properly. The reason it wasn't working was because my parent model was declared before the nested one. This problem originated from the name of my source files and the fact that I'm using Rails' asset pipeline.
This change allows a model to be specified as a string so that model class declaration order is not important. It should be backwards compatible.
Unfortunately, I have not included tests.
If you can add a test I'll merge this in
I'm pretty swamped at the moment, but I'll see what I can do.
Please add in NestedModel example that order of nested models declarations have to be above main model declaration. It took me bunch of time to figure out it.
Are we still interested in merging this in (if it isn't too stale)? If so, I'll add a test so we can get it done.