emberjs/website — pull request #932 by edruder (2013-09-24 04:12:48+00:00)
Title: Work-around for ember-data fixtures "limitation"

Defines the fixtures in an ID range that's unlikely to collide with todos generated by hand.

Given that the `ember-data` fixtures adapter provides a `generateIdForRecord` method that uses a private `counter` variable, initialized to 0, that's incremented for each fixture created.

Given that the the Getting Started | Using Fixtures guide defines three Todo fixtures with IDs 1, 2, and 3.

When the user completes the Getting Started | Creating a New Model Instance guide, they can create one new Todo, which is given an ID of 0 by `generateIdForRecord`.

When the user tries to create a second Todo, BOOM!

This is the easiest work-around that I can think of for this problem.

Another, more-permanent fix would be to modify `DS.FixtureAdapter#fixturesForType` to make sure that `counter` is always larger than the largest numerical ID in a Fixtures file. But I don't know if that would mesh with the philosophy of `DS.FixtureAdapter`.