Diving into Ember-cli

I'm sure this is something small and silly that I am missing but cannot get my fixtures to load. Here I have ...

app / models / todos.js

import DS from 'ember-data';

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

Todo.reopenClass({
  FIXTURES: [
    {
      id: "1",
      title: 'install ember-cli',
      isCompleted: true
   }, {
     id: "2",
     title: 'install additional dependencies',
     isCompleted: true
    }, {
      id: "3",
      title: 'develop amazing things',
      isCompleted: false
  }
]});

export default Todo;

      

application / adapters / application.js

import DS from 'ember-data';

export default DS.FixtureAdpater.extend();

      

App / routes / todos.js

import Ember from 'ember';

export default Ember.Route.extend({
  model: function() {
    return this.store.all('todo');
  }
});

      

app / router.js

import Ember from 'ember';

var Router = Ember.Router.extend({
  location: TodosENV.locationType
});

Router.map(function() {
  this.resource('todos', { path: '/' });
});

export default Router;

      

Brocfile.js

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp();

app.import({
  development: 'vendor/ember-data/ember-data.js',
  production:  'vendor/ember-data/ember-data.prod.js'
}, {
  'ember-data': [
    'default'
  ]
});

module.exports = app.toTree();

      

I was able to pass the binding data to the views via routes using

this.store.push(todo: {some junk});    

      

but can't figure out what i am doing wrong in the models files.

Any help would be greatly appreciated, thanks.

+3


source to share


1 answer


This is just a guess, but I'm wondering if I need to change this.store.all('todo');

to this.store.find('todo');

. I'm pretty sure this all()

will only return records that are already loaded from the repository.



+4


source







All Articles