Reputation: 11234
Learning Ember with Ember.js guides. While practicing ToDo application, I renamed model from todo
to tododata
but I get Error while processing route: todos No model was found for 'tododata' Error: No model was found for 'tododata'})
.
Renaming model back to todo
works fine. Not sure what is wrong (except the fact there is CamelCase is being used). Would appreciate some direcction
My setup:
Model: In guide Todos.Todo
but I named it Todos.TodoData
for clarity.
Todos.TodoData = DS.Model.extend({
...
});
Router: In guide ...find('todo');
, I use ...find('tododata');
Todos.TodosRoute = Ember.Route.extend({
model: function() {
return this.store.find('tododata');
}
});
Controller: In guide it was todo
, mine is tododata
Todos.TodosController = Ember.ArrayController.extend({
actions: {
...
var todo = this.store.createRecord('tododata', {
...
});
...
}
});
Using TodoData
instead of tododata
works fine but I am not sure if this is a correct usage (because my thinking is tododata
is an instance of TodoData
).
Upvotes: 1
Views: 6619
Reputation: 2890
You need to consider using camelCase when calling this.store for that model. There are two options to handle camelCase in this.store methods arguments:
Ember uses Ember.DefaultResolver to find what you requested. You can override it's behavior if you need so (https://github.com/emberjs/ember.js/blob/v1.7.0/packages/ember-application/lib/system/resolver.js#L115).
Upvotes: 4