DS.Model.relationshipNames

relationshipNamesObjectstatic

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

A hash containing lists of the model's relationships, grouped by the relationship kind. 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 relationshipNames = Ember.get(Blog, 'relationshipNames');
relationshipNames.hasMany;
//=> ['users', 'posts']
relationshipNames.belongsTo;
//=> ['owner']
doc_EmberJs
2016-11-30 16:50:17
Comments
Leave a Comment

Please login to continue.