17

I need a way to get first record of specific model .at this time im using a way like this :

this.store.findAll('configModel').then(function(items) {
 items.get('content')[0].set('isEnableShowUniqueName', true);
 items.get('content')[0].set('isSavedToServer', false);
 items.get('content')[0].save();
});

but I think there is a better and ember way out there? is this way true? do you know any better way? but know this I haven't id of record I need the only first record of the model.

MBehtemam
  • 7,865
  • 15
  • 66
  • 108

1 Answers1

37

You have firstObject, lastObject and objectAt.

items.get('firstObject');
JP Silvashy
  • 46,977
  • 48
  • 149
  • 227
dagda1
  • 26,856
  • 59
  • 237
  • 450