[AC-1208] Model-View binding does not work if Model name has a captial letter at the beginning
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Invalid |
Resolution Date | 2015-02-11T22:15:56.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy |
Labels | TCSupportTriage, defect |
Reporter | David He |
Assignee | Mauro Parra-Miranda |
Created | 2014-10-06T10:11:25.000+0000 |
Updated | 2016-03-08T07:37:35.000+0000 |
Description
Alloy compiler is complaining when Models are named like Book.js.
See this feature-related test case [https://github.com/feons/alloy/tree/ALOY-443/test/apps/testing/ALOY-443]
Error
[ERROR] : Attempt to reference the deep object reference : "Book.title". [ERROR] : Instead, please map the object property to an attribute of the model. [ERROR] : Alloy compiler failedTest Case
<Alloy>
<Model src="Book"/>
<Window id="index" title="Visitor List" tintColor="#FFFFFF" tabBarHidden="true">
<View layout="vertical">
<Label text="Text Size" />
<Slider value="{Book.title}" max="5" min="1"/>
</View>
</Window>
</Alloy>
exports.definition = {
config : {
columns : {
"title" : "string",
"author" : "string"
},
adapter : {
type : "sql",
collection_name : "Book"
}
},
extendModel : function(Model) {
_.extend(Model.prototype, {
// extended functions and properties go here
});
return Model;
},
extendCollection : function(Collection) {
_.extend(Collection.prototype, {
// extended functions and properties go here
});
return Collection;
}
};
I reckon it is supposed to be a very quick fix and expect it in possible 1.5.2 soon :)
Also, I recommend full model-view binding test case could be part of Alloy sample project [https://github.com/appcelerator/alloy]
Models must be named with a lowercase letter. The Backbone constructor is named with a lead-capitalized letter and instance of the model are named with the matching, though lowercase-first-letter version of the name.