# Get record id without making a request

**URL:** <https://discuss.emberjs.com/t/get-record-id-without-making-a-request/4196>\
**Category:** Ember Data\
**Created:** [February 18, 2014, 6:53am UTC](https://discuss.emberjs.com/t/get-record-id-without-making-a-request/4196 "2014-02-18T06:53:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zzarcon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/zzarcon/32/15279_2.png) [@zzarcon](https://discuss.emberjs.com/u/zzarcon)\
**Post date:** [February 18, 2014, 6:53am UTC](https://discuss.emberjs.com/t/get-record-id-without-making-a-request/4196/1 "2014-02-18T06:53:36Z")

</div>

Hi Guys,

I’ve been using ember + ember data from more than 5 months ago and I have a problem when I’m trying to render the id of a record in a simple list, without making a request to my Api for each record

Here is my code:

```
//Models
App.Team = DS.Model.extend({
  name: DS.attr('string'),
  managerNickname: DS.attr('string'),
  user: DS.belongsTo('user')
});

 App.User = DS.Model.extend({
  email: DS.attr('string'),
  firstName: DS.attr('string'),
  lastName: DS.attr('string'),
 });
 
 //Template
 {{#each team in this}}
    {{team.user.id}}
 {{/each}}

```

The line `{{team.user.id}}` makes a request!

So, my question is: Why this making a request if I only I’m acceding to the user id? this is a bug or is the expected behavior? I’ve been thinking about it a lot and I have not found sense for this, I mean, if I currently have the user id why I need to do these request??

Thanks for reading and I hope your answers!

---

<div class="post-metadata">

**Author:** ![josepjaume](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/josepjaume/32/4125_2.png) [@josepjaume](https://discuss.emberjs.com/u/josepjaume)\
**Post date:** [February 18, 2014, 8:20am UTC](https://discuss.emberjs.com/t/get-record-id-without-making-a-request/4196/2 "2014-02-18T08:20:56Z")

</div>

I’ve been struggling with this as well. It’s specially noticeable when you are linking models.

```auto
{{#each team in this}}
  {{link-to "user" team.user}}
{{/each}}

```

I believe the `PromiseProxy` that `DS.belongsTo('user')` is returning should not delegate the id and use the one coming from the backend instead, so it doesn’t even have the need of getting a model back unless you ask for something other than the id.

Does that make any sense? Is it worth a PR to `ember-data`?

---

<div class="post-metadata">

**Author:** ![abuiles](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/abuiles/32/15106_2.png) [@abuiles](https://discuss.emberjs.com/u/abuiles)\
**Post date:** [February 18, 2014, 12:03pm UTC](https://discuss.emberjs.com/t/get-record-id-without-making-a-request/4196/3 "2014-02-18T12:03:13Z")

</div>

@josepjaume that would be really useful!

---

<div class="post-metadata">

**Author:** ![mspisars](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/mspisars/32/14253_2.png) [@mspisars](https://discuss.emberjs.com/u/mspisars)\
**Post date:** [February 18, 2014, 5:46pm UTC](https://discuss.emberjs.com/t/get-record-id-without-making-a-request/4196/4 "2014-02-18T17:46:17Z")

</div>

I think this is worth a PR!

---

<div class="post-metadata">

**Author:** ![cibernox](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/cibernox/32/15004_2.png) [@cibernox](https://discuss.emberjs.com/u/cibernox)\
**Post date:** [February 20, 2014, 11:25am UTC](https://discuss.emberjs.com/t/get-record-id-without-making-a-request/4196/5 "2014-02-20T11:25:06Z")

</div>

**T.O.T.A.L.L.Y.** agree. Specially for links to other resources. I don’t show any detail of the object in the link, so I don’t want to fetch the data until I enter its route!

In fact I think that this should be used everywhere. I think that the object we have in ember-data relations should not fetch data unless we ask for an attribute that has already been set.
