user101010101
user101010101

Reputation: 1659

No data from rest call

I am simply wanting to return data from a url localhost:8080/rest/items. Below is the ember code but it does seem to return or make a call to get any data;

       App = Ember.Application.create({

});

var attr = DS.attr;

App.Item = DS.Model.extend({
    name : attr(),
});

App.Store = DS.Store.extend({
      revision: 12,
      adapter: 'DS.FixtureAdapter'
    });

App.Store = DS.Store.extend({
      revision: 12,
      adapter: DS.RESTAdapter.create({
        url: 'rest'
      })
    });

App.ItemRoute = Ember.Route.extend({
      model: function () {
        App.Item.find();
      }
});

I am new to ember and do not know what is incorrect with this code.

Upvotes: 0

Views: 63

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

switch to a newer version of ember data (http://builds.emberjs.com/tags/v1.0.0-beta.3/ember-data.js), and do it like this

DS.RESTAdapter.reopen({
  namespace: 'rest'
});

App = Ember.Application.create({});

var attr = DS.attr;

App.Item = DS.Model.extend({
    name : attr(),
});

App.ApplicationAdapter = DS.RESTAdapter;

App.ItemRoute = Ember.Route.extend({
      model: function () {
        this.store.find('item');
      }
});

Upvotes: 1

Related Questions