-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change _normalizeTypeKey to defer normalization to the container
First, remember that isolated containers have no normalization. When testing with isolated containers, the user-entered model key becomes the container object name as well as the type key. For example, in a unit test this modelFor works like this: * `modelFor("SomeItem")` * Looks for `"model:SomeItem"` in the container * This is normalized to `"model:SomeItem"` (unit tests have no normalization) * The object is returned. In Ember-CLI, a error. In globals Ember, `App.SomeItem`. * The typeKey is set to the normalized value: `SomeItem` In an acceptance or app environment the container has a different resolver. In these cases normalization changes things. For example, with the Ember-CLI resolver: * `modelFor("SomeItem")` * Looks for `"model:SomeItem"` in the container * This is normalized to `"model:some-item"` (Ember-CLI is dasherizing) * The object is returned. In Ember-CLI, `app/models/some-item`. * The typeKey is set to the normalized value: `some-item` What must be added to this confusing situation is that RESTAdapter defers to the `typeKey` for model keys. If you change your resolver, you will change the requests sent to your server and the way data is parsed.
- Loading branch information
Showing
5 changed files
with
59 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters