Created
June 14, 2013 04:05
-
-
Save jrallison/5779381 to your computer and use it in GitHub Desktop.
Ember with fixtures
This file contains 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 = Em.Application.create | |
LOG_TRANSITIONS: true | |
rootElement: "#application" | |
App.Store = DS.Store.extend | |
revision: 12, | |
# Specifying the fixture adapter rather than RESTAdapter, etc | |
adapter: DS.FixtureAdapter.create() | |
App.Campaign = DS.Model.extend | |
name: DS.attr "string" | |
type: DS.attr "string" | |
App.Campaign.FIXTURES = [ | |
{ | |
id: "1", | |
name: "first campaign", | |
type: "behavioral" | |
}, | |
{ | |
id: "2", | |
name: "second campaign", | |
type: "transactional" | |
}, | |
{ | |
id: "3", | |
name: "third campaign", | |
type: "newsletter" | |
} | |
]; | |
# This will just return the 3 fixtures rather than making an API request | |
App.Campaign.find() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment