DS.PromiseArray And Em.ArrayController should proxy meta property


First off, I think that PromiseArray should proxy meta, so that this works:

promiseArray = store.find('foo', {page: 1});

promiseArray.then(function(foos) {
 promiseArray.get('meta') // should not be null
 foos.get('meta') // works but is confusing why both don't work

I also think that Ember Data should reopen ArrayController to do the same, or it should happen in ember - not sure what the best place to do that in is, but the following should definitely work IMO:

App.ApplicationRoute = Em.Route.extend({
  model: function() {
    return this.store.find('foo');
{{meta.someProperty}} {{! should work }}
{{content.meta.someProperty}} {{! currently works but confusing, not required for e.g. length }}

Happy to provide a PR if anyone agrees


I was caught by this and was very very confused as to why I couldn’t access the meta info.


I’m just curious as to why meta becomes a reserved keyword in templates therefore, no? It’d be really good to keep the reserved keywords down IMHO. Maybe I’ve misunderstood. (Probably), so apologies in advance!


No, it doesn’t become reserved. It is just proxied to the underlying content variable of ArrayControllers if it’s not defined already. So this would still work:

App.FooController = Em.ArrayController.extend({meta: 'Something else'});

As would using meta in templates as a name. It doesn’t affect any use case where meta is already defined or used for something else.


Sweetness and light! :smile: