Skip to content

Commit

Permalink
[DOCS] [BUGFIX] Get model relationships by string
Browse files Browse the repository at this point in the history
Fixes #5804
Access relationships by model name like
relationships.get('user');
  • Loading branch information
rajasegar authored and runspired committed Mar 4, 2019
1 parent 41a3b80 commit 1ebff8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/-private/system/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1512,10 +1512,10 @@ Model.reopenClass({
import Post from 'app/models/post';
let relationships = Ember.get(Blog, 'relationships');
relationships.get(User);
relationships.get('user');
//=> [ { name: 'users', kind: 'hasMany' },
// { name: 'owner', kind: 'belongsTo' } ]
relationships.get(Post);
relationships.get('post');
//=> [ { name: 'posts', kind: 'hasMany' } ]
```
Expand Down

0 comments on commit 1ebff8c

Please sign in to comment.