inverseFor (name) Objectstatic
Find the relationship which is the inverse of the one asked for.
For example, if you define models like this:
app/models/post.jsimport DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('message')
});
app/models/message.jsimport DS from 'ember-data';
export default DS.Model.extend({
owner: DS.belongsTo('post')
});
App.Post.inverseFor('comments') -> { type: App.Message, name: 'owner', kind: 'belongsTo' } App.Message.inverseFor('owner') -> { type: App.Post, name: 'comments', kind: 'hasMany' }
Parameters:
-
name
String - the name of the relationship
Returns:
-
Object - the inverse relationship, or null
Please login to continue.