I keep getting a "No model was found for '0'" error when trying to connect an Ember.js app to a Rails 3.2 API. My setup is below. Any help will be greatly appreciated.
Items Controller (Rails)
def index
@items = Item.all
respond_to do |format|
format.html
format.json { render json: @items, root: true }
end
end
App.js (Ember.js)
App = Ember.Application.create();
App.Router.map(function() {
this.resource('items', function() {
this.route('backlog');
this.route('board');
});
});
App.ItemsRoute = Ember.Route.extend({
model: function() {
return this.store.find('item');
}
});
Server response when the Ember app makes request to /items
[
{
"item": {"id":1,"item_type":"Item","name":"Test item"}
},
{
"item": {"id":2,"item_type":"Item","name":"Test item 2"}
}
]