mardi 4 juillet 2017

Error: not rendering ember-data, receiving ||| instead;

-I am using Ember-CLI-Mirage as my backend server for creating mock data.

-Instead of receiving two records, I receive just |||. When I look to the console i see Objectclasses: Array(2)proto: Object.

-So I will list everything I have from the code down (except two more models, but I am just focus on model 'class'):

app/mirage/config.js

export default function() {
  this.get('/classes'),
  this.get('/classes/:id'),
  this.get('/classes/:id', ['classes', 'students']),
  this.get('/students', ['students', 'subjects', 'classes']),
  this.get('/subjects', ['students', 'subjects']),
  this.post('/students/:id'),
  this.put('/subjects/:id')
}

app/mirage/fixtures/classes.js:

export default [ 
        {id: 1, name: 'I', students: [1, 2]},
        {id: 2, name: 'II', students: [3, 4]}
];

app/mirage/scenarios/default.js:

export default function(server ) {

  server.loadFixtures();
}

app/models/class.js:

import DS from 'ember-data';

export default DS.Model.extend({
        name: DS.attr('string'),
        students: DS.hasMany('student')
});

app/templates/index.hbs:

<b> Neki sadrzaj </b> <br>

Liquid error: wrong number of arguments (1 for 0)
         <br>



app/routes/class.js:

import Ember from 'ember';

export default Ember.Route.extend({
        model(){
                return this.store.findAll('class');
        }
});

-Thanks, in advance!




Aucun commentaire:

Enregistrer un commentaire