0
votes

I'm trying to build a simple ember application (filebrowser) using an AMD approach (yes i know about @tomdale's views on AMD) based on https://github.com/fernandogmar/Emberjs-RequireJS, which seems to work nicely except I'm getting a weird request URL when trying to use this DS.Model:

App.File = DS.Model.extend({
    primaryKey: "URI",

    url: "file",

    URI: DS.attr("string")
});

Called with:

window.App.DataStore.find(File, encodeURIComponent("/"));

(Unrelated question: is there any way to get the datastore from within a router or controller with get()? Router.get("DataStore") returns undefined.)

Using the standard unmodified RESTAdapter. Results in the following request URL:

http://127.0.0.1:8020/model)s/%2F

I can't figure out what causes this. Presumable the 's' at the end is the adapter trying to pluralize the model name. I don't have a clue where the paren comes from.

Ember version: v1.0.0-pre.2-123-ga352c48

Ember-data version: latest downloaded from https://github.com/emberjs/data/downloads yesterday (can't find a version number anywhere).

Could this be related to the AMD approach or is this an unrelated issue, and most importantly: how do i fix it?

Thanks for your time.

1

1 Answers

0
votes

I found that using File.reopenClass() to set the url property instead of setting it in extend() does fix the problem. This doesn't explain why the default magic for generating the modelname returns model)s, but atleast it fixes my problem for now.