ember.js - Is there a way to get an Ember model's hasMany children without specifying relationship name? -
say have model:
app.contact = ds.model.extend name: ds.attr('string') addresses: ds.hasmany('app.address')
i know can grab addresses doing:
@get('model').get('addresses')
but have many models, each having 1 or more different hasmany relationships. there way generically grab relationships?
something like:
@get('model').get('hasmany')
given ember model class, can it's of relationships like:
var attributes = ember.get(app.post, 'attributes'); var relationships = ember.get(app.post, 'relationships');
if don't know type of model, can replace app.post
with
var klass = model.get('constructor'); //or based on question var klass = this.get('model.constructor');
Comments
Post a Comment