Skip to content

Instantly share code, notes, and snippets.

@mehulkar
Created November 11, 2012 09:52
Show Gist options
  • Save mehulkar/4054327 to your computer and use it in GitHub Desktop.
Save mehulkar/4054327 to your computer and use it in GitHub Desktop.
Ember ArrayProxy magical magic
a = Ember.A()
a.pushObject(1);
a.pushObject(2);

a.slice(-1);
// [1]
a = Ember.ArrayProxy.create({content:[]});

a.pushObject(1);
a.pushObject(2);

a.slice(-1);
// [undefined, 1, 2]
a.content.slice(-1)
// [1]

Slicing the content property of the ArrayProxy works as intended, but in the case of DS.ManyArray, slice returns clientIds instead of objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment