Helping Sprouts Grow




Ask me anything

Using your fixtures in sc-build

Alright, so you read through the datastore tutorial, it told you all about fixtures, and that it was a stop gap for hooking up to a real data source.  It even gave you a neat shortcut to fall back on fixtures.

// in main.js:

MyApp.main = function() {

  // switch to fixtures if #fixtures in URL

  if (window.location.hash.toString().match(‘fixtures’)) {

    MyApp.store.from(SC.Record.fixtures);

  }

  …

}

But! It forgot to tell you how to use fixtures when you don’t have a backend setup yet, but still need to deploy somewhere for demo purposes!

Buildfile to the rescue! Add “:load_fixtures => true” into your buildfile & deploy, voila! Fixture data on the live server.

config :all, :required => :sproutcore, :load_fixtures => true