Created
June 6, 2015 20:55
-
-
Save StevenMcD/c0d9e3c9ed194528b56e to your computer and use it in GitHub Desktop.
Attempt at getting Ember fixtures working in ember 1.12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--******************************** | |
// app.js | |
import Ember from 'ember'; | |
import Resolver from 'ember/resolver'; | |
import loadInitializers from 'ember/load-initializers'; | |
import config from './config/environment'; | |
import DS from 'ember-data'; | |
var App; | |
Ember.MODEL_FACTORY_INJECTIONS = true; | |
App = Ember.Application.extend({ | |
modulePrefix: config.modulePrefix, | |
Resolver: Resolver | |
}); | |
App.ApplicationAdapter = DS.FixtureAdapter; | |
loadInitializers(App, config.modulePrefix); | |
export default App; | |
//--******************************** | |
// models/artist.js | |
import DS from 'ember-data'; | |
let Artist = DS.Model.extend({ | |
ArtistName : DS.attr('string'), | |
Genre : DS.attr('string'), | |
YearsActive : DS.attr('number') | |
}); | |
Artist.reopenClass({ | |
FIXTURES: [ | |
{id: 'fixture-0', ArtistName: 'Metallica', Genre: 'Hard Rock', YearsActive: 34}, | |
{id: 'fixture-1', ArtistName: 'Slipknot', Genre: 'Metal', YearsActive: 20}, | |
{id: 'fixture-2', ArtistName: 'The Beebs', Genre: 'Not Music', YearsActive: 7} | |
] | |
}); | |
export default Artist; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment