Skip to content

_injectRelations failing when being invoked with array in 1.0.0 #202

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

Closed
pietschy opened this issue Oct 6, 2014 · 3 comments
Closed

_injectRelations failing when being invoked with array in 1.0.0 #202

pietschy opened this issue Oct 6, 2014 · 3 comments

Comments

@pietschy
Copy link

pietschy commented Oct 6, 2014

I've updated to 1.0.0 and now have an issue similar to #188. Now it's failing when the array has multiple items.

This plunker demonstrates the issue (it's a fork of the 188 issue plunker so I hope I haven't buggered it up.)
http://plnkr.co/edit/S0z9v3ubnrzY53xh9nSJ?p=preview
Patching at line 5443 to the following seems to fix it:

if (definition.relations) {
    // evil hacky if/elsey fix.   
    if (Array.isArray(injected)) {
      for (var i = 0; i < injected.length; i++) {
        _injectRelations.call(DS, definition, injected[i]);  
      } 
    } else {
      // was just calling this.
      _injectRelations.call(DS, definition, injected);  
    }
  }
@jmdobry
Copy link
Member

jmdobry commented Oct 6, 2014

Your plunker is using angular-data 0.10.5 (the version is in the banner at the top of each file). If I paste in the file linked to below then it works.

You can see in dist/angular-data.js#L6517 for 1.0.0 that this is fixed (_injectRelations is only called on single items).

@pietschy
Copy link
Author

pietschy commented Oct 6, 2014

Uggg.. oops. I'd blindly used bundle update with rails assets and didn't read the fine print. Sorry about that.

It is indeed working with 1.0.0.

Thanks!

@jmdobry
Copy link
Member

jmdobry commented Oct 6, 2014

😄

@jmdobry jmdobry closed this as completed Oct 6, 2014
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

2 participants