Function

record
Object
a record instance previously obstained from the store.
returns
StableRecordIdentifier

Retrieves the unique referentially-stable RecordIdentifier assigned to the given record instance.

1
2
3
4
5
6
7
8
9
10
import { recordIdentifierFor } from "@ember-data/store";

// ... gain access to a record, for instance with peekRecord or findRecord
const record = store.peekRecord("user", "1");

// get the identifier for the record (see docs for StableRecordIdentifier)
const identifier = recordIdentifierFor(record);

// access the identifier's properties.
const { id, type, lid } = identifier;