failing test of embedded records in a filter #568

wants to merge 1 commit into

4 participants


I get the following error when using a filter with a server query for embedded records:

TypeError: Cannot call method 'hasOwnProperty' of undefined

I don't get the same error with a normal find, so I assume the error is in the filter logic somewhere.

This pull request contains a failing test to demonstrate the problem.


Also have that issue.


Is it still an issue ? I tried to rewrite the test against master, but I don't get this error.... but an other one... Could you try to write it against master ?


Sorry for the delayed response. I'll try to work on rewriting this test against master in the next few days.


I'm late too... Thanks for this :)


Ok, I've just wrote a test against master, and the behavior you described now works.

test("the filter method with server query works with embedded records", function() {
  var MyAdapter = DS.Adapter.extend();

    dogs: DS.hasMany(Dog)
  });, {
    dogs: { embedded: 'always' }

  var adapter = MyAdapter.create();
  store.set('adapter', adapter);

  adapter.findQuery = function(store, type, query, array) {
    this.didFindQuery(store, type, { persons: [
      {id: 1, name: "Yehuda Katz", dogs: []},
      {id: 2, name: "Tom Dale", dogs: [{ name: "Tank" }, {name: "Fluffy"}] }
    ]}, array);

  var filter = store.filter(Person, { name: "Tom Dale" }, function(data) {
    return data.get('name') === "Tom Dale";

  equal(get(filter, 'length'), 1, "The filter has an item in it");

  var tom = filter.objectAt(0);
  equal(tom.get('dogs.length'), 2, "loads embedded records");
  equal(tom.get('dogs').objectAt(0).get('name'), 'Tank', "loads embedded record attributes");

@stefanpenner I don't know if we should just close it, or if this test is relevant enough to push it.


@sly7-7 Thank you for finishing this. Your test looks good.

Ember.js member

@sly7-7 I'm gonna close this, but please feel free to submit a PR for a test that would catch for a regression.

@tomdale tomdale closed this May 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment