4
votes

So forgive me in advance, I'm obviously totally new to ember (and pretty new to JS in general as well. I'm going through the enhanced Getting Started tutorial, following it line by line, (unless I missed something) when my browser decides to render nothing but the background. I backtracked and noticed it happens immediately after altering the router as directed here: http://emberjs.com/guides/getting-started/displaying-model-data/

I commited and pushed to github here: https://github.com/justuseapen/ember_tut_mock

^The first commit rendered in the browser fine, the second commit is broken, if you want to see the difference.

This is my console output:

Uncaught ReferenceError: Todos is not defined todo.js:1
DEBUG: ------------------------------- ember.js:394
DEBUG: Ember.VERSION : 1.0.0 ember.js:394
DEBUG: Handlebars.VERSION : 1.0.0 ember.js:394
DEBUG: jQuery.VERSION : 1.10.2 ember.js:394
DEBUG: ------------------------------- ember.js:394
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Assertion failed: No model was found for 'todo' ember.js:394
(anonymous function) ember.js:394
DEPRECATION: Action handlers contained in an `events` object are deprecated in favor of 

putting them in an `actions` object (error on <Ember.Route:ember222>)
            at Object.triggerEvent
Error while loading route: 
TypeError
 ember.js:394
Uncaught TypeError: Cannot set property 'store' of undefined 

This is the router.js that breaks the code:
Todos.Router.map(function () {
  this.resource('todos', { path: '/' });
});

Todos.TodosRoute = Ember.Route.extend({
  model: function () {
    return this.store.find('todo');
  }
});

this is the model with fixtures:

Todos.Todo = DS.Model.extend({
  title: DS.attr('string'),
  isCompleted: DS.attr('boolean')
});

Todos.Todo.FIXTURES = [
 {
   id: 1,
   title: 'Learn Ember.js',
   isCompleted: true
 },
 {
   id: 2,
   title: '...',
   isCompleted: false
 },
 {
   id: 3,
   title: 'Profit!',
   isCompleted: false
 }
];

any ideas are greatly appreciated.

1

1 Answers

0
votes

It's a bug in that version of Ember Data (maybe Ember/Ember Data)

http://emberjs.jsbin.com/OpOsIGEK/1/edit