Skip to content

Instantly share code, notes, and snippets.

@jrallison
Created June 14, 2013 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrallison/5779381 to your computer and use it in GitHub Desktop.
Save jrallison/5779381 to your computer and use it in GitHub Desktop.
Ember with fixtures
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