Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model relationships get by string or class? #5804

Closed
yaxinr opened this issue Dec 21, 2018 · 3 comments
Closed

model relationships get by string or class? #5804

yaxinr opened this issue Dec 21, 2018 · 3 comments
Labels
🏷️ doc This PR adds/improves/or fixes documentation

Comments

@yaxinr
Copy link

yaxinr commented Dec 21, 2018

import Blog from 'app/models/blog';
import User from 'app/models/user';
import Post from 'app/models/post';

let relationships = Ember.get(Blog, 'relationships');
WRONG: relationships.get(User);
THIS WORKS: relationships.get('user');

@runspired
Copy link
Contributor

Hi @yaxinr, usage questions like this belong being asked on the Ember discord, discuss forum, or stack overflow.

It seems you answered your own question though: you access by modelName and not via a class.

@runspired runspired reopened this Feb 16, 2019
@runspired
Copy link
Contributor

Reopening as I realized you were trying to point out a mistake in the documentation. Thank you! You are correct that there is one.

rajasegar added a commit to rajasegar/data that referenced this issue Mar 4, 2019
Fixes emberjs#5804
Access relationships by model name like
relationships.get('user');
@rajasegar
Copy link
Contributor

@runspired Raised a PR #5891 for the same, kindly verify

@runspired runspired added 🏷️ doc This PR adds/improves/or fixes documentation and removed Documentation labels Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ doc This PR adds/improves/or fixes documentation
Projects
None yet
Development

No branches or pull requests

3 participants