Can't fetch data :(

I have just started using EmberJS for a new application of mine.

In my application, you are about to create a new Job, as a part of the creating, you need to tell what field of work it is. These fields should be fetched from my rails server, let me show you some code.

The servicefield model.

MyApp.ServiceField = DS.Model.extend
  name: DS.attr('string')
  description: DS.attr('string')
  services: DS.hasMany('service')

My routes

MyApp.Router.map ()->
  @route 'home.index', { path: '/' }
  @resource 'jobs', ->
    @route 'new'

And the controller for the new page

MyApp.JobsNewController = Ember.ObjectController.extend
  fields : Sanatid.ServiceField.all()

Now this yields

Assertion failed: Your application does not have a 'Store' property defined. Attempts to call 'all' on model classes will fail. Please provide one as with 'YourAppName.Store = DS.Store.extend()' 

So i thought hmm, this doesn’t make sense, as i have it defined right here.

MyApp.Store = DS.Store.extend
  revision: 11
  adapter: DS.RESTAdapter.create()

What is wrong?

Bonus question. As i need the the service fields for the user to choose from, i attach them to the controller, is this the correct place to handle such?

The fix was to move the fetch to a route, i think the controller was loaded before the DS.Store maybs? Atleast it makes more sence, to only request the data, when needed. :smile: