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

Check if async relation is null without fetching relation #2286

Closed
lrdevries opened this issue Sep 17, 2014 · 4 comments
Closed

Check if async relation is null without fetching relation #2286

lrdevries opened this issue Sep 17, 2014 · 4 comments

Comments

@lrdevries
Copy link

Hello,

I've got a page where i want to show all elements without an relation. To determine this i have the following code:

lonelyModels: function(){
    var array = this.get("allModels");
    var self = this;
    return array.filter(function(item,index,enuma){
        return !item.get("relationToB");
    });
}.property("[email protected]"),
allModels: function(){
  return this.store.find("modelA");
}.property();

But now it also makes requests to the server for the model behind relationToB. But i only need the object without an relation set, so i also do not need the async relations. When you've got 1000 records in the database, its a real bummer for efficiency. How can i get all modelA objects without a relation to modelB, without loading the relations that does exists. (and if one in the list gets a relation it should also be removed from the list)

@intuitivepixel
Copy link

This doesn't look like a bug, either like a programming problem for which you could find surely a better answer on stackoverflow.com then here :)

@lrdevries
Copy link
Author

I think it is a bug, because async relations are always loaded. But indeed
i formulated it to much as a question
Op 20 sep. 2014 00:36 schreef "intuitivepixel" [email protected]:

This doesn't look like a bug, either like a programming problem for which
you could find surely a better answer on stackoverflow.com then here :)


Reply to this email directly or view it on GitHub
#2286 (comment).

@wecc
Copy link
Contributor

wecc commented Nov 14, 2014

Relevant: #2431

@igorT
Copy link
Member

igorT commented May 25, 2015

Yes, this is a real use case that we want to support, emberjs/rfcs#57 is aiming to address it. Closing this as a duplicate of #2271

@igorT igorT closed this as completed May 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants