You can just set the full url as the property that gets set for the model instead of a relative URL. Like this:
App.User = Ember.Model.extend({
id: attr(),
name: attr(),
comments: hasMany("App.Comment", {key: 'comment_ids'})
});
App.User.url = "http://example.com/users";
Update:
If you don't want to specify the hostname in multiple places, the simplest thing to do would probably be to assign the hostname to a variable and then reference the variable when you're declaring the URL. If you really want to get into the ember model internals, though, you could also override the buildURL method in a custom adapter, like this:
App.CustomAdapter = Ember.RESTAdapter.extend({
buildURL: function(klass, id) {
var urlRoot = "http://example.com/" + Ember.get(klass, 'url');
if (!urlRoot) { throw new Error('Ember.RESTAdapter requires a `url` property to be specified'); }
if (!Ember.isEmpty(id)) {
return urlRoot + "/" + id + ".json";
} else {
return urlRoot + ".json";
}
}
});