I found that if I try to include the url in the original definition of an ember-data model it blows up in my REST adapter but if I simply “reopenClass” it’s fine.
What is the technical reason behind this? (below is the working example)
CodeCamp.Speaker = DS.Model.extend({
id: DS.attr('number'),
name: DS.attr('string'),
session: DS.belongsTo('CodeCamp.Session')
});
CodeCamp.Speaker.reopenClass({
url: 'sessions/%@/speakers'
});
Calling
extendon an object sets instance attributes, whereasreopenClasssets class attributes.The
urlattribute is a class-level attribute,as opposed to: