I'm confused. I have following model, transforms for attr tags and fixtures:
Tracker.Story = DS.Model.extend({
title: DS.attr('string'),
tags: DS.attr('array', []),
});
DS.ArrayTransform = DS.Transform.extend({
deserialize: function(serialized) {
return serialized;
},
serialize: function(deserialized) {
return deserialized.split(',');
}
});
Tracker.register("transform:array", DS.ArrayTransform);
Tracker.Story.FIXTURES = [
{
id: 1,
title: "Some story",
tags: ["tag1", "tag2", "tag3"],
}
and template
{{#each itemController="story"}}
{{title}}
{{#each tag in tags}}
{{tag}}
{{/each}}
{{/each}}
It's works nice for story from FIXTURES. I added new story via interface, where input field define as:
{{input type="text" value=tags}}
Transforms correctly works and return array from string ([1,2,3] from "1,2,3" for example).
But failed rendering tags for added story with next messages:
Assertion failed: The value that #each loops over must be an Array. You passed 1 ember.js:417
Uncaught TypeError: Object 1 has no method 'addArrayObserver' ember.js:22976
Uncaught Error: Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.