DS.Model.typeForRelationship()

typeForRelationship (name, store) DS.Modelstatic

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

For a given relationship name, returns the model type of the relationship.

For example, if you define a model like this:

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

export default DS.Model.extend({
  comments: DS.hasMany('comment')
});

Calling App.Post.typeForRelationship('comments') will return App.Comment.

Parameters:

name String
the name of the relationship
store Store
an instance of DS.Store

Returns:

DS.Model
the type of the relationship, or undefined
doc_EmberJs
2016-11-30 16:50:19
Comments
Leave a Comment

Please login to continue.