How to subclass or inherit a model from another model using ember-data

Viewed 4512

Let's say my rails models look like this:

class SalesRelationship < ActiveRecord

end

Which is inherited by crossSell like this:

class crossSell < SalesRelationship 

end

How do I show this inheritance relationship in ember-data. What is the best practise for this:

App.salesRelationship = DS.Model.extend({
  name: DS.attr('string')
});

Can I create a subclass called 'crossSell', like this

crossSell = App.salesRelationship({
    productName: DS.attr('string')
});

or like this

 App.salesRelationship.crossSell  = DS.Model.extend({
    productName: DS.attr('string')
  });
2 Answers
Related