Skip to content

Teach WarpDrive schemas in PolarisMode in chapter 11 - #296

Draft
NullVoxPopuli-ai-agent wants to merge 5 commits into
ember-learn:mainfrom
NullVoxPopuli-ai-agent:nvp/warp-drive-polaris
Draft

NullVoxPopuli-ai-agent wants to merge 5 commits into
ember-learn:mainfrom
NullVoxPopuli-ai-agent:nvp/warp-drive-polaris

Conversation

@NullVoxPopuli-ai-agent

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Chapter 11 now uses WarpDrive in PolarisMode and nothing from @warp-drive/legacy.

What changes for the reader:

  • app/models/rental.js becomes app/schemas/rental.js. It has a withDefaults schema from @warp-drive/core/reactive.
  • The type getter becomes a derived field with a registered rentalType derivation.
  • app/services/store.js uses useRecommendedStore from @warp-drive/core, with the schema and the derivation.
  • The model test becomes tests/unit/schemas/rental-test.js. The chapter creates it directly, because the model-test generator comes from @warp-drive/legacy.
  • A hidden step removes @warp-drive/legacy when the blueprint installed it.
  • The recap and the chapter list name schemas and request builders.

Why this PR needs the others:

Tests: I ran CI=true pnpm generate locally against ember-source 7.4.0 with the #21771 fix added. The whole tutorial passed, and pnpm lint:md:dist passed. CI stays red until #21771 is in a released ember-source and #338 is in the alpha blueprint.

Thanks to @BlueCutOfficial (Marine Dunstetter) for the WarpDrive migration guide in ember-learn/guides-source#2246 and the Mainmatter posts that walk Super Rentals to WarpDrive (part 1, part 2). This chapter continues from that path to PolarisMode.

PolarisMode tutorial PRs

Merge in this order:

  1. Build the tutorial against ember-source main #294: builds the tutorial against ember-source main.
  2. [BUGFIX beta] LinkTo: do not read unknown properties from models emberjs/ember.js#21771: fixes <LinkTo @model={{record}}> with PolarisMode records.
  3. Use useRecommendedStore and drop @warp-drive/legacy ember-cli/ember-app-blueprint#338: new apps use useRecommendedStore without @warp-drive/legacy.
  4. Teach WarpDrive schemas in PolarisMode in chapter 11 #296 (this PR): chapter 11 teaches WarpDrive schemas in PolarisMode.

Related:

🤖 Generated with Claude Code

NullVoxPopuli and others added 3 commits October 26, 2026 14:48
Add a `main` channel to the Build matrix. It uses the alpha ember-cli
and app blueprint, then installs the latest ember-source build of
ember.js main. ember.js CI uploads that build to builds.emberjs.com,
and canary.json points to it.

A hidden step after `ember new` installs the tarball when
EMBER_SOURCE_TARBALL is set. Other channels do not set it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an `ember-source` input to workflow_dispatch. It takes a full
ember.js commit SHA or a tarball URL. A SHA maps to its build on
builds.emberjs.com. If the input is empty, the main channel uses the
latest build, as before. The step checks that the tarball exists, so a
SHA with no build stops the job before the slow steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chapter 11 now defines the rental type with a schema from
`@warp-drive/core/reactive`. The `type` getter becomes a derived field
with a registered derivation. The store uses `useRecommendedStore`,
and the chapter removes `@warp-drive/legacy`.

The model test becomes a schema test in `tests/unit/schemas/`. The
`model-test` generator comes from the legacy package, so the chapter
creates the file directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
## The Store Service

## Testing Models
EmberData provides a `store` *[service](../../../services/)*, also known as the EmberData store. The store needs to know about our schema and our derivation before it can create rental records. The default blueprint generated an `app/services/store.js` file for us. Let's replace its contents:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EmberData provides a `store` *[service](../../../services/)*, also known as the EmberData store. The store needs to know about our schema and our derivation before it can create rental records. The default blueprint generated an `app/services/store.js` file for us. Let's replace its contents:
WarpDrive provides a `store` *[service](../../../services/)*. The store needs to know about our schema and our derivation before it can create rental records. The default blueprint generated an `app/services/store.js` file for us. Let's replace its contents:

```

EmberData offers many, many features (like managing the *relationships* between different models) and there's a lot more we can learn about it. For example, if your backend's have some inconsistencies across different endpoints, EmberData allows you to define request specific handlers and builders! We are just scratching the surface here. If you want to learn more about EmberData, check out [its own dedicated section](../../../models/) in the guides!
EmberData offers many, many features (like managing the *relationships* between different types of records) and there's a lot more we can learn about it. For example, if your backend's have some inconsistencies across different endpoints, EmberData allows you to define request specific handlers and builders! We are just scratching the surface here. If you want to learn more about EmberData, check out [its own dedicated section](../../../models/) in the guides!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EmberData offers many, many features (like managing the *relationships* between different types of records) and there's a lot more we can learn about it. For example, if your backend's have some inconsistencies across different endpoints, EmberData allows you to define request specific handlers and builders! We are just scratching the surface here. If you want to learn more about EmberData, check out [its own dedicated section](../../../models/) in the guides!
WarpDrive offers many, many features (like managing the *relationships* between different types of records) and there's a lot more we can learn about it. For example, if your backend's have some inconsistencies across different endpoints, WarpDrive allows you to define request specific handlers and builders! We are just scratching the surface here. If you want to learn more about WarpDrive, check out [its own dedicated section](../../../models/) in the guides!

We can access these attributes on a rental record using standard dot notation, such as `rental.title` or `rental.location.lat`. In addition to the fields we declared here, there will always be an *id* field as well, which is used to uniquely identify the record and can be accessed using `rental.id`.

Model classes in EmberData are no different than any other classes we've worked with so far, in that they allow for a convenient place for adding custom behavior. We took advantage of this feature to move our `type` logic (which is a major source of unnecessary duplication in our route handlers) into a getter on our model class. Once we have everything working here, we will go back to clean that up.
Since a schema does not contain code, we cannot add a getter to it the way we would with a class. Instead, we declared `type` as a `derived` field. When we read `rental.type`, EmberData calls the `rentalType` *[derivation](https://warp-drive.io/guides/the-manual/schemas/derivations)* function with the record and returns its result. We took advantage of this feature to move our `type` logic (which is a major source of unnecessary duplication in our route handlers) into one place. Once we have everything working here, we will go back to clean that up.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @NullVoxPopuli, I am noticing something about how this paragraph is phrased. It sounds like an artifact of the former class-based Model, it says that "if it had been class-based we could have used a getter", which make it sounds a bit like something is missing from the concept of Schema and we need to workaround it.
Woudn't it be better to explain what type is conceptually, and why a Derivation is the best way to implement this property in Schema world?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would! thank you!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @BlueCutOfficial. 736c88b rewrites the paragraph. It now says that the server does not send type, that type comes from category, and that a derived field is how a schema holds a value like that. The comparison with a class getter is gone.

NullVoxPopuli and others added 2 commits October 27, 2026 10:34
Apply the review suggestions that name WarpDrive for the store service
and the closing paragraph. The derived field paragraph now explains
what type is and why a derivation fits, instead of comparing schemas
to model classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename EmberData to WarpDrive in the chapter text, headings, the part 2
index and the recap. The Zoey note keeps the old name, so that readers
can match it to older guides and addons. The chapter URL stays
ember-data, so existing links keep working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants