I'm new to ember, and try to understand how it works.
I've defined a store with a fixturesAdapter as adapter (rev 7). I've defined two models:
App.Tag = DS.Model.extend({
name: DS.attr('string'),
item: DS.belongsTo('App.Item')
});
and:
App.Item = DS.Model.extend({
name: DS.attr('string'),
tags: DS.hasMany(App.Tag, { embedded:true }),
})
I also fill their associated fixtures and at last a controller:
App.itemsController = Ember.ArrayController.create({
content: App.store.findAll(App.Item)
});
I've defined a function inside App.Item model:
tagline: function(){
return this.get('tags').toArray().map(function(tag){
return tag.get('name');
}).join(',');
}.property('[email protected]')
Here is the corresponding jsfiddle: http://jsfiddle.net/K286Q/29/
My questions are:
- What am I doing wrong?
- Why does it see several tags associated to first item, but is not able to get their name?