Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX release] Fix Model.modelName inheritance with Ember 3.2+. #5406

Merged
merged 2 commits into from Mar 30, 2018

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Mar 30, 2018

On Ember 3.2 and higher, Ember uses "real" inheritance when an Ember.Object is .extend()ed. This means that in 3.2 and higher the ModelClassHere.modelName property is now being inherited (where previously each .extend() reset the value to null).

The fix here ensures that each ModelClass.extend() gets its own modelName...

Copy link
Contributor

@runspired runspired left a comment

Choose a reason for hiding this comment

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

Thanks for helping track this down!

@runspired
Copy link
Contributor

Changing the check to the below will fix the tests for pre ember canary:

if (!klass.modelName || !klass.hasOwnProperty('modelName')) {
        klass.modelName = modelName;
      }

Copy link
Contributor

@runspired runspired left a comment

Choose a reason for hiding this comment

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

needs to add a check for missing modelName unfortunately.

On Ember 3.2 and higher, Ember uses "real" inheritance when an
`Ember.Object` is `.extend()`ed. This means that in 3.2 and higher the
`ModelClassHere.modelName` property is now being inherited (where
previously each `.extend()` reset the value to `null`).

The fix here ensures that each `ModelClass.extend()` gets its own
`modelName`...
This test was attempting to ensure that the records guid was included in
the `record.toString()` output, but changes in Ember 3.2+ changed the
default output of the class / constructor name portion (therefore
failing the assertion in a useless way).

This updates the test to add a custom `toString` to the model class so
that we can be decoupled from how Ember `.toString()`'s classes when
there is no custom `.toString` setup (because this is actually fairly
unstable version over version).
@runspired runspired merged commit 823dbbd into emberjs:master Mar 30, 2018
@rwjblue rwjblue deleted the fix-model-name-with-canary branch March 30, 2018 12:00
runspired added a commit that referenced this pull request Aug 28, 2018
* [BUGFIX release] Fix `Model.modelName` inheritance with Ember 3.2+.

On Ember 3.2 and higher, Ember uses "real" inheritance when an
`Ember.Object` is `.extend()`ed. This means that in 3.2 and higher the
`ModelClassHere.modelName` property is now being inherited (where
previously each `.extend()` reset the value to `null`).

The fix here ensures that each `ModelClass.extend()` gets its own
`modelName`...

* [BUGFIX release] Fix toString test to work with Ember 3.2+.

This test was attempting to ensure that the records guid was included in
the `record.toString()` output, but changes in Ember 3.2+ changed the
default output of the class / constructor name portion (therefore
failing the assertion in a useless way).

This updates the test to add a custom `toString` to the model class so
that we can be decoupled from how Ember `.toString()`'s classes when
there is no custom `.toString` setup (because this is actually fairly
unstable version over version).

* fix branch
runspired added a commit that referenced this pull request Aug 28, 2018
* [BUGFIX release] Fix `Model.modelName` inheritance with Ember 3.2+.

On Ember 3.2 and higher, Ember uses "real" inheritance when an
`Ember.Object` is `.extend()`ed. This means that in 3.2 and higher the
`ModelClassHere.modelName` property is now being inherited (where
previously each `.extend()` reset the value to `null`).

The fix here ensures that each `ModelClass.extend()` gets its own
`modelName`...

* [BUGFIX release] Fix toString test to work with Ember 3.2+.

This test was attempting to ensure that the records guid was included in
the `record.toString()` output, but changes in Ember 3.2+ changed the
default output of the class / constructor name portion (therefore
failing the assertion in a useless way).

This updates the test to add a custom `toString` to the model class so
that we can be decoupled from how Ember `.toString()`'s classes when
there is no custom `.toString` setup (because this is actually fairly
unstable version over version).

* fix branch
runspired added a commit that referenced this pull request Aug 28, 2018
* [BUGFIX release] Fix `Model.modelName` inheritance with Ember 3.2+.

On Ember 3.2 and higher, Ember uses "real" inheritance when an
`Ember.Object` is `.extend()`ed. This means that in 3.2 and higher the
`ModelClassHere.modelName` property is now being inherited (where
previously each `.extend()` reset the value to `null`).

The fix here ensures that each `ModelClass.extend()` gets its own
`modelName`...

* [BUGFIX release] Fix toString test to work with Ember 3.2+.

This test was attempting to ensure that the records guid was included in
the `record.toString()` output, but changes in Ember 3.2+ changed the
default output of the class / constructor name portion (therefore
failing the assertion in a useless way).

This updates the test to add a custom `toString` to the model class so
that we can be decoupled from how Ember `.toString()`'s classes when
there is no custom `.toString` setup (because this is actually fairly
unstable version over version).

* fix branch
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.

None yet

3 participants