We have a few ways of getting the resource ID: resource._getUid() works, but the underscore makes it look like an internal method I shouldn't depend on. resource.toJSON().id also works, but it processes the entire data structure which I don't need. Finally, resource.get('id') doesn't work, which surprises me.
Is there a recommended and stable way of getting a resource object's ID?
We have a few ways of getting the resource ID:
resource._getUid()
works, but the underscore makes it look like an internal method I shouldn't depend on.resource.toJSON().id
also works, but it processes the entire data structure which I don't need. Finally,resource.get('id')
doesn't work, which surprises me.Is there a recommended and stable way of getting a resource object's ID?