So, I found this pull request on github. It's 8 months old, so won't work due to added complexity since then, but I've implemented the workaround suggested like so:
App.store = DS.Store.create({
revision: 4,
adapter: DS.RESTAdapter.create({
plurals: {
'cart': 'cart'
}
})
});
App.Cart.reopenClass({
find: function () {
this._super("singleton");
}
});
On my server (I'm using rails), I have to add the following to my routes:
get "cart/:ignored" => "carts#show"
Then I have to add the following to CartSerializer
(using active_model_serializers gem):
attributes :id
def id
"singleton"
end
This is necessary, because, apparently, if the id in the json response doesn't match the id requested from find() (singleton
in this case), then ember won't load the data into the model.
Now, this obviously isn't the ideal solution, but until ember-data adds support for it, it seems like the least painful way to go.
By the way, I filed an issue to add support.