Bug fix: hasMany loaded as null is throwing exception #848

Merged
merged 1 commit into from Jun 20, 2013

Projects

None yet

4 participants

@bradfol

If a hasMany relationship is loaded as null, don't throw Adapter is either null or does not implement 'findHasMany' method. I have written some failing tests for this situation. I also committed a proposed fix, but not sure if it is the right approach.

Change introduced at this commit 81e6fde for these files:
system/relationships/has_many.js:20
system/store.js:679

@bradfol

Improved fix to use not equal null, because undefined == null. Better than using strict not equal against undefined, based on this info.

@tomdale
Ember.js member

I think this is a good fix, but can we bring this up-to-date with the recent reference changes?

@bradfol

@tomdale thanks for taking a look. I have updated my commits to reflect the recent changes.

@sly7-7

@bradfol It seems like the same as #936, with the patch :). Perhaps it would be usefull to add a test against undefined
@tomdale If this one is merged, then you could close the other one as well ;)

@tomdale
Ember.js member

Why are we checking for false?

@bradfol

@tomdale I have removed the check for false. (Was patched to deal with an API that returned false for empty relationships, but I see that is not the correct API behavior.)

@sly7-7 Also added a test for undefined which is already passing.

@sly7-7

@bradfol Thank you, I will close my PR. I think @tomdale will merge this one if you squash the commits.

@bradfol

I have squashed the commits, thanks @sly7-7 @tomdale

@bradfol

@stefanpenner could we get this merged in?

@stefanpenner stefanpenner merged commit ca7ba71 into emberjs:master Jun 20, 2013

1 check passed

Details default The Travis CI build passed
@stefanpenner
Ember.js member

@bradfol boom!

@bradfol

@stefanpenner Thank you!

@bradfol bradfol deleted the bradfol:hasmany branch Jun 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment