Ember's extremely straightforward question is here, (I hope so!).
I have a simple setup for Ember data. One application has many versions. Here is my application model:
App.App = DS.Model.extend({ name: DS.attr('string'), publicKey: DS.attr('string'), versions: DS.hasMany('App.Version', { key: 'version_ids' }) });
My router is pretty simple:
App.Router = Ember.Router.extend({ location: 'hash', root: Ember.Route.extend({ index: Ember.Route.extend({ route: '/', redirectsTo: 'dashboard' }), dashboard: ..., app: Ember.Route.extend({ route: '/:app_id', connectOutlets: function(router, app) { router.get('applicationController').connectOutlet('appTest', app); }, index: Ember.Route.extend({ route: '/', connectOutlets: function(router) { appTestController = router.get('appTestController'); appTestController.connectOutlet('addCommentOutlet', 'addComment', {}); appTestController.connectOutlet('versions', appTestController.get('content.versions')); } }) }) }) });
Both views and controllers look like this:
App.AppTestView = Ember.View.extend({ templateName: 'app_test' }); App.VersionsView = Ember.View.extend({ templateName: 'versions' }); App.AppTestController = Ember.ObjectController.extend({ }); App.VersionsController = Ember.ArrayController.extend({ });
When I run it, unfortunately, I get an error: an Ember.CollectionView content must implement Ember.Array. You passed <App.Version:ember519> an Ember.CollectionView content must implement Ember.Array. You passed <App.Version:ember519> .
Interestingly, if I add brackets around [appTestController.get('content.versions')] in the router, it will not complain and will correctly create an array with the first Version object. But it seems that he does not want to show more than one object.
Any tips?