0
votes

I am just starting out with Ember and using the docs at http://emberjs.com/api/data/classes/DS.Adapter.html to create a custom adapter for accessing a SOAP web service. When I try to access the store that uses this adapter, however, I get this error:

TypeError: Cannot call method 'lookupFactory' of undefined

Here's my code:

App = Ember.Application.create();

App.RMSoapAdapter = DS.Adapter.extend({

    find: function(store, type, id) {
        switch(type) {
        case 'group-mailbox':
            return getGroupMailboxForStore(id, store);
            break;
        default:
            throw 'Unknown object type: ' + String(type);
            break;
        }
    }
});

App.store = DS.Store.create({
  adapter: App.RMSoapAdapter.create(),
});


App.IndexRoute = Ember.Route.extend({
  model: function() {
    var store = App.store;
      return store.find('group-mailbox');
  }
});
1

1 Answers

2
votes

That documentation is a little wonky, that's if you want to set up a different store etc, but if you are wanting to use the built in store you would do it like this.

App.ApplicationAdapter = App.RMSoapAdapter;

App.IndexRoute = Ember.Route.extend({
  model: function() {
      return this.store.find('group-mailbox');
  }
});

And the type must be a valid DS model, it's looking up the group-mailbox and it's going to send in App.GroupMailbox, not the string.

App.GroupMailbox = DS.Model.extend({

});