Skip to content


Added failing test for findHasMany behavior #609

wants to merge 1 commit into from

6 participants


Using findHasMany in the pattern indicated by the has_many test will result in all HasMany in a uncommitted state, rather than saved.


Hey guys - any insight into this? This effectively prevents one from using a hasMany <-> belongsTo relationship if you want to lazy load related models (that is, if you don't have a list of your related model ids on initial load).

Note that this only happens if you define the relationship both ways. If you only define a hasMany, everything works fine.

Ember.js member

Strange that this bug is still present, because I don't understand how anyone that uses hasMany relations doesn't run into this. It also conflicts with the dirtiness test 'By default, changing the relationship between two records does not cause them to become dirty'. Somehow the loadHasMany updates the children and marks them as uncommitted, while it clearly shouldn't. Anyone?

@tomdale tomdale was assigned
Ember.js member

I don't think this test applies anymore since the stateManager has been merged into the record itself.

Ember.js member

@jonasi I hate to make you do this again, but can you update for the latest. We are working harder to clean up Ember Data so hopefully we can merge this before we break it on you again!


Rebased and updated the test to match the newer state setup. Looks like it's still failing though:

Module Failed: Has-Many Relationships
  Test Failed: A serializer can materialize a hasMany as an opaque token that can be lazily fetched via the adapter's findHasMany hook
    Assertion Failed:
      Expected: root.loaded.saved, Actual: root.loaded.updated.uncommitted
    Assertion Failed: Expected 8 assertions, but 9 were run
Ember.js member

This is pretty inconsistent with the current implementation and shouldn't be an issue with the relationship refactor I have planned.

@wycats wycats closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 10, 2013
  1. @jonasi
Showing with 1 addition and 0 deletions.
  1. +1 −0 packages/ember-data/tests/integration/has_many_test.js
1 packages/ember-data/tests/integration/has_many_test.js
@@ -182,6 +182,7 @@ asyncTest("A serializer can materialize a hasMany as an opaque token that can be
equal(comments.get('isLoaded'), true);
equal(comments.get('length'), 2);
+ equal(comments.objectAtContent(0).get('currentState.stateName'), 'root.loaded.saved');
Something went wrong with that request. Please try again.