jeudi 26 mars 2015

Ember CLI - Fixture data not displaying

I am following this guide http://ift.tt/1iUmzBM


I am simply trying to display a list of my fixture data in the personalities resource route. What am I doing wrong?




As soon as I try to obtain the model in my route, the the template no longer renders.


routes/personalities.coffee



`import Ember from 'ember'`

PersonalitiesRoute = Ember.Route.extend
model: ->
this.get(store).find('personality')

`export default PersonalitiesRoute`


The above is the portion of code that breaks the app (compiles, but displays nothing). What am I doing wrong?


I have my adapter, template, and model as follows


I made sure to use a fixture adapter adapters/application.coffee



`import DS from 'ember-data'`

ApplicationAdapter = DS.FixtureAdapter.extend()

`export default ApplicationAdapter`


adapters/personalities.coffee



`import ApplicationAdapter from './application'`

PersonalitiesAdapter = ApplicationAdapter.extend()

`export default PersonalitiesAdapter`


I tried adding a personalities adapter as well, to no avail. do I need one? What's the proper setting?


templates/personalities.emblem



= each item in model
= item.id
= item.type
= item.socType
= item.description


models/personality.coffee



`import DS from 'ember-data'`

Personality = DS.Model.extend
id: attr('number')
type: attr('string')
socType: attr('string')

Personality.reopenClass
FIXTURES: [
{ id: 1, type: 'entp', socType: 'NLE' }
{ id: 2, type: 'isfp', socType: 'SFI' }
{ id: 3, type: 'esfj', socType: 'ESE' }
{ id: 4, type: 'intj', socType: 'LII' }
{ id: 5, type: 'enfj', socType: 'EIE' }
{ id: 6, type: 'istj', socType: 'LSI' }
{ id: 7, type: 'estp', socType: 'SLE' }
{ id: 8, type: 'infp', socType: 'IEI' }
{ id: 9, type: 'esfp', socType: 'SEE' }
{ id: 10, type: 'intp', socType: 'ILI' }
{ id: 11, type: 'entj', socType: 'LIE' }
{ id: 12, type: 'isfj', socType: 'ESI' }
{ id: 13, type: 'estj', socType: 'LSE' }
{ id: 14, type: 'infj', socType: 'FII' }
{ id: 15, type: 'enfp', socType: 'NEE' }
{ id: 16, type: 'istp', socType: 'SLI' }
]

`export default Personality`




Aucun commentaire:

Enregistrer un commentaire