ember.js - Model Not Found in Ember App Kit -


i'm trying use ember app kit ember data (i'm using latest of both) using fixtures - reason i'm getting following:

assertion failed: no model found 'todo' [vm] ember.js (4005):415

error while loading route: typeerror {} [vm] ember.js (4005):415

uncaught typeerror: cannot set property 'store' of undefined ember-data.js:2182

application

import resolver 'resolver'; import registercomponents 'appkit/utils/register_components';  var app = ember.application.extend({   log_active_generation: true,   log_module_resolver: true,   log_transitions: true,   log_transitions_internal: true,   log_view_lookups: true,   moduleprefix: 'appkit', // todo: loaded via config   resolver: resolver });  app.initializer({   name: 'register components',   initialize: function(container, application) {     registercomponents(container);   } });  app.applicationadapter = ds.fixtureadapter.extend();  export default app; 

index route

import todo 'appkit/models/todo';  var indexroute = ember.route.extend({   model: function() {     return this.store.findall('todo');   } });  export default indexroute; 

todo model

var todo = ds.model.extend({   'title': ds.attr('string'),   'user': ds.attr('object'),   'comment': ds.attr('string'),   'mood': ds.attr('string') });  todo.fixtures = [{      'title': 'received hardware!',      'user': { 'username': 'alvincrespo' },      'comment': 'finally received hardware!',     'mood': 'happy' }, {     'title': 'this honorable.',      'user': { 'username': 'robwolf' },      'comment': 'i regret already.',     'mood': 'happy' }, {     'title': 'i can\'t seem speak',      'user': { 'username': 'catstark' },      'comment': 'wait minute, why hear?',     'mood': 'sad' }, {     'title': 'attendance poor.',      'user': { 'username': 'cerlan' },      'comment': 'kings landing seems pretty empty after war.',     'mood': 'neutral' }];  export default todo; 

i've declared ds.fixtureadapter in app.js reason still not working? ideas?

thanks!

i'm not positive register components pieces does. it's saying doesn't know todo model (generally find looking model's described in namespace, aka app.todo = ds.model.extend....)

you might need still declare store.

 app.store = ds.store.extend(); 

and in ember data 1.0 beta 1 adapter so

 app.applicationadapter = ds.myrestadapter; // note don't extend/create 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -