Basic functionality with Fixtures


#1

Is there a basic tutorial or guide on using Ember fixtures? I have gone through the tilde training but it drops right in the middle of a project and I am trying to start from Ember new following the same conventions taught in the course.

Posted on S/O

error received : File: project-voice/routes/application.js ENOENT, no such file or directory '/Users/../tmp/tree_merger-tmp_dest_dir-VUc8t50a.tmp/models/speaker-fixtures.js'

Is there something I am missing that will help ember find my fixture file? This is my first attempt in creating an app outside a tutorial and I am a bit lost. *I also tried setting up the fixture in the model how it explains in the embercli doc and could not get that work.

Any push in the right direction would help tremendously. Thanks


#2

http://stackoverflow.com/questions/23839551/where-is-fixture-data-in-ember-js-with-cli http://emberjs.com/guides/models/the-fixture-adapter/ http://emberjs.com/guides/getting-started/using-fixtures/

This should get you on the right track. The only difference would be modifying old syntax slightly from 'app. …Adapter.extend to the newer …

'import Ember from ‘ember’;

export default ember.fixtureAdapter.extend ({

// Fixture code from those articles goes here…

})

You should be using ember-cli which automates the creation of this file/start code with… 'ember g adapter ’ then add ‘Fixture’ to the generated code. It can be specified from the initial ‘ember g’ command I just forget.

  1. http mock servers are superior to Fixture adapters due to a more close resemblance of actual production code eventually required.
    Just run ember g http-mock and then insert data in JSON format in the generated folder => Server/mocks/resource.js on line 7 between the [] brackets. I believe that requires an adapter… ‘ember g adapter application’ and insertion of =>

export default… {

namespace: ‘api’

}

Its worthwhile familiarizing yourself w/ process of adding the ‘Model Hook’ on the route.js file from each resource you use with an API… easy to do and a constant on most apps.

-emberwatch.com -emberweekly.com -ember-cli 101 -Adolfo -developing an Ember.js edge - Matt Beale n friends -Codeschool course - warming up with ember -+100 bloggers who do app/feature implementation write-ups …

Good Luck


#3

I ended up using a relative path and it worked: import '../models/speaker-fixtures';

But this is all great info. Especially http mock servers, I will keep this in mind for my next app.