DS.Model.relatedTypes

relatedTypesEmber.Arraystatic

Defined in addon/-private/system/relationships/ext.js:415

An array of types directly related to a model. Each type will be included once, regardless of the number of relationships it has with the model.

For example, given a model with this definition:

app/models/blog.js
import DS from 'ember-data';

export default DS.Model.extend({
  users: DS.hasMany('user'),
  owner: DS.belongsTo('user'),

  posts: DS.hasMany('post')
});

This property would contain the following:

import Ember from 'ember';
import Blog from 'app/models/blog';

var relatedTypes = Ember.get(Blog, 'relatedTypes');
//=> [ App.User, App.Post ]
doc_EmberJs
2016-11-30 16:50:17
Comments
Leave a Comment

Please login to continue.