Is there a good way to handle enumerators when using Ember Data and its RESTAdapter?


#1

Let’s say I have a State model:

App.State = DS.Model.extend({
    name: DS.attr('string'), // e.g. "Missouri"
    code: DS.attr('string'), // e.g. "MO"
    createdAt: DS.attr('date'), // e.g. 1821-09-10
});

Let’s assume we’re not creating, editing, or deleting states. But we want to be able to use states, for example as a property of our Concert model which has a state_id in the JSON. Let’s also assume that there’s no real reason to have network traffic for a /state endpoint, and it’d be better to simply include all 50 states in the JS on pageload.

Is there an idiomatic way to do this? Some way to use something like the FixtureAdapter for only certain models, but still use the RESTAdapter for the vast majority of things?