Function
typeForRelationship (name, store) Model public
Module:
@ember-data/model
Defined in ../packages/model/addon/-private/model.js:1255
- name
- String
- the name of the relationship
- store
- Store
- an instance of Store
- returns
- Model
- the type of the relationship, or undefined
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 | |
1 2 3 4 5 |
import Model, { hasMany } from ' -data/model'; export default class PostModel extends Model { ('comment') comments; } |
Calling store.modelFor('post').typeForRelationship('comments', store)
will return Comment
.