String as ID with RESTadapter


Hi ember devs :slight_smile:

I’m trying to use a guid-ish generated Id for some of my models. A given ID would be something like: “A7GEVNNEIF34GFE743EFDNJ432”.

Fetching the data into the data store isn’t an issue. The ID’s (and the rest of the data) is correctly displayed. Later getting a specific item with peekRecord(“pluralmodelname”, id) returns an issue. I believe the adapter needs to be given an integer rather than a string.

Is there a known way to circumvent this problem? Possible by reopening the adapter and changing stuff…




I don’t think the data adapter handles ids as a numeric value. I use dashed guids in my apps and haven’t had an issue so far. What’s the “returns an issue” exactly? Keep in mind peekRecord doesn’t return a promise.


I did the same thing via serializer. Create a serializer and set primaryKey attribute to the json key that you want to use as Id. It worked for me with JSON adapter but I think it should work with the RestAdapter too.


Ah. I feel stupid. I works and have always worked. For testing purposes I referenced an id with a static value, a value for an id that obviously didn’t exist once the switch to guid’s were made. :slight_smile: