Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1208] Model-View binding does not work if Model name has a captial letter at the beginning

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2015-02-11T22:15:56.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy
LabelsTCSupportTriage, defect
ReporterDavid He
AssigneeMauro Parra-Miranda
Created2014-10-06T10:11:25.000+0000
Updated2016-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 failed

Test 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;
	}
}; 

Comments

  1. David He 2014-10-06

    I reckon it is supposed to be a very quick fix and expect it in possible 1.5.2 soon :)
  2. David He 2014-10-06

    Also, I recommend full model-view binding test case could be part of Alloy sample project [https://github.com/appcelerator/alloy]
  3. Tim Poulsen 2015-02-11

    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.

JSON Source