diff --git a/README.md b/README.md
index f812b8dc..4777bddd 100644
--- a/README.md
+++ b/README.md
@@ -88,26 +88,26 @@ In the following examples, assume the models look like this:
```javascript
// standard models
- User = DS.Model.extend({
- name: DS.attr('string'),
- style: DS.attr('string'),
- projects: DS.hasMany('project'),
- hats: DS.hasMany('hat', {polymorphic: true})
- });
+ class User extends Model {
+ @attr('string') name
+ @attr('string') style
+ @hasMany('project') projects
+ @hasMany('hat', {polymorphic: true}) hats
+ }
- Project = DS.Model.extend({
- title: DS.attr('string'),
- user: DS.belongsTo('user')
- });
+ class Project extends Model {
+ @attr('string') title
+ @belongsTo('user') user
+ }
// polymorphic models
- Hat = DS.Model.extend({
- type: DS.attr('string'),
- user: DS.belongsTo('user')
- });
+ class Hat extends Model {
+ @attr('string') type
+ @belongsTo('user') user
+ }
- BigHat = Hat.extend();
- SmallHat = Hat.extend();
+ class BigHat extends Hat {};
+ class SmallHat extends Hat {};
```
### Defining Factories
@@ -561,10 +561,10 @@ Let's say you have a model and a factory like this:
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
- export default Model.extend({
- dogNumber: attr('string'),
- sound: attr('string')
- });
+ export default class Dog extends Model{
+ @attr('string') dogNumber
+ @attr('string') sound
+ }
// tests/factories/dog.js
import FactoryGuy from 'ember-data-factory-guy';
@@ -1071,23 +1071,23 @@ For example, say we have the following `Employee` model which makes use of the `
```javascript
// Employee model
-export default Model.extend({
- name: fragment('name'),
- phoneNumbers: fragmentArray('phone-number')
-})
+export default class Employee extends Model {
+ @fragment('name') name
+ @fragmentArray('phone-number') phoneNumbers
+}
// Name fragment
-export default Fragment.extend({
- titles: array('string'),
- firstName: attr('string'),
- lastName: attr('string')
-});
+export default class Name extends Fragment {
+ @array('string') titles
+ @attr('string') firstName
+ @attr('string') lastName
+}
// Phone Number fragment
-export default Fragment.extend({
- number: attr('string')
- type: attr('string')
-});
+export default class PhoneNumber extends Fragment {
+ @attr('string') number
+ @attr('string') type
+}
```
A factory for this model and its fragments would look like so:
@@ -2086,10 +2086,10 @@ describe('Admin View', function() {
```javascript
// app/serializers/person.js
- export default DS.RESTSerializer.extend({
+ export default class PersonSerializer extends RESTSerializer {
// let's say you're modifying all names to be Japanese honorific style
- serialize: function(snapshot, options) {
+ serialize(snapshot, options) {
var json = this._super(snapshot, options);
let honorificName = [snapshot.record.get('name'), 'san'].join('-');
@@ -2097,7 +2097,7 @@ describe('Admin View', function() {
return json;
}
- });
+ }
// somewhere in your tests
let person = make('person', {name: "Daniel"});
diff --git a/addon/factory-guy.js b/addon/factory-guy.js
index 7f21e6e0..9a52524b 100644
--- a/addon/factory-guy.js
+++ b/addon/factory-guy.js
@@ -68,10 +68,10 @@ class FactoryGuy {
/**
```javascript
- Person = DS.Model.extend({
- type: DS.attr('string'),
- name: DS.attr('string')
- })
+ class Person extends Model {
+ @attr('string') type
+ @attr('string') name
+ }
FactoryGuy.define('person', {
sequences: {
diff --git a/tests/dummy/app/adapters/application.js b/tests/dummy/app/adapters/application.js
index 1afb56b6..07ca7a64 100644
--- a/tests/dummy/app/adapters/application.js
+++ b/tests/dummy/app/adapters/application.js
@@ -3,4 +3,4 @@
import AdapterFetch from 'ember-fetch/mixins/adapter-fetch';
import JSONAPIAdapter from '@ember-data/adapter/json-api';
-export default JSONAPIAdapter.extend(AdapterFetch);
+export default class extends JSONAPIAdapter.extend(AdapterFetch) {}
diff --git a/tests/dummy/app/controllers/profiles.js b/tests/dummy/app/controllers/profiles.js
index 62ed609a..f2d6a836 100644
--- a/tests/dummy/app/controllers/profiles.js
+++ b/tests/dummy/app/controllers/profiles.js
@@ -1,2 +1,2 @@
import Controller from '@ember/controller';
-export default Controller.extend();
+export default class extends Controller {}
diff --git a/tests/dummy/app/controllers/search/results.js b/tests/dummy/app/controllers/search/results.js
new file mode 100644
index 00000000..c16b95dc
--- /dev/null
+++ b/tests/dummy/app/controllers/search/results.js
@@ -0,0 +1,11 @@
+import Controller from '@ember/controller';
+
+export default class extends Controller {
+ get previousPage() {
+ return this.model.meta?.previous;
+ }
+
+ get nextPage() {
+ return this.model.meta?.next;
+ }
+}
diff --git a/tests/dummy/app/controllers/users.js b/tests/dummy/app/controllers/users.js
index 69029c4e..3df08e0a 100644
--- a/tests/dummy/app/controllers/users.js
+++ b/tests/dummy/app/controllers/users.js
@@ -1,9 +1,9 @@
import Controller from '@ember/controller';
+import { action } from '@ember/object';
-export default Controller.extend({
- actions: {
- deleteUser(user) {
- return user.destroyRecord();
- },
- },
-});
+export default class extends Controller {
+ @action
+ deleteUser(user) {
+ return user.destroyRecord();
+ }
+}
diff --git a/tests/dummy/app/models/big-group.js b/tests/dummy/app/models/big-group.js
index 248717e0..a46de081 100644
--- a/tests/dummy/app/models/big-group.js
+++ b/tests/dummy/app/models/big-group.js
@@ -1,6 +1,6 @@
import Group from './group';
import { attr } from '@ember-data/model';
-export default Group.extend({
- type: attr('string', { defaultValue: 'BigGroup' }),
-});
+export default class extends Group {
+ @attr('string', { defaultValue: 'BigGroup' }) type;
+}
diff --git a/tests/dummy/app/models/big-hat.js b/tests/dummy/app/models/big-hat.js
index bcabce55..aa73afcd 100644
--- a/tests/dummy/app/models/big-hat.js
+++ b/tests/dummy/app/models/big-hat.js
@@ -1,6 +1,6 @@
import Hat from './hat';
import { hasMany } from '@ember-data/model';
-export default Hat.extend({
- materials: hasMany('soft-material', { async: false }),
-});
+export default class extends Hat {
+ @hasMany('soft-material', { async: false }) materials;
+}
diff --git a/tests/dummy/app/models/billing-address.js b/tests/dummy/app/models/billing-address.js
index 9c2b0aeb..e251dfc0 100644
--- a/tests/dummy/app/models/billing-address.js
+++ b/tests/dummy/app/models/billing-address.js
@@ -1,6 +1,6 @@
import { attr } from '@ember-data/model';
import Address from 'dummy/models/nested-fragment/address';
-export default Address.extend({
- billingAddressProperty: attr('number'),
-});
+export default class extends Address {
+ @attr('number') billingAddressProperty;
+}
diff --git a/tests/dummy/app/models/cat.js b/tests/dummy/app/models/cat.js
index 211eb9a6..29646933 100644
--- a/tests/dummy/app/models/cat.js
+++ b/tests/dummy/app/models/cat.js
@@ -1,7 +1,7 @@
import Model, { attr } from '@ember-data/model';
-export default Model.extend({
- type: attr('string'),
- name: attr('string'),
- friend: attr('string'),
-});
+export default class extends Model {
+ @attr('string') type;
+ @attr('string') name;
+ @attr('string') friend;
+}
diff --git a/tests/dummy/app/models/comic-book.js b/tests/dummy/app/models/comic-book.js
index 083b09cc..fbc54e6e 100644
--- a/tests/dummy/app/models/comic-book.js
+++ b/tests/dummy/app/models/comic-book.js
@@ -1,8 +1,8 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- name: attr('string'),
- company: belongsTo('company'),
- characters: hasMany('person', { polymorphic: true }),
- includedVillains: hasMany('villain'),
-});
+export default class extends Model {
+ @attr('string') name;
+ @belongsTo('company') company;
+ @hasMany('person', { polymorphic: true }) characters;
+ @hasMany('villain') includedVillains;
+}
diff --git a/tests/dummy/app/models/company.js b/tests/dummy/app/models/company.js
index 29078c1a..7a9a85f9 100644
--- a/tests/dummy/app/models/company.js
+++ b/tests/dummy/app/models/company.js
@@ -1,9 +1,9 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- type: attr('string', { defaultValue: 'Company' }),
- name: attr('string'),
- profile: belongsTo('profile', { async: false }),
- users: hasMany('user', { async: true, inverse: 'company' }),
- projects: hasMany('project', { async: true }),
-});
+export default class extends Model {
+ @attr('string', { defaultValue: 'Company' }) type;
+ @attr('string') name;
+ @belongsTo('profile', { async: false }) profile;
+ @hasMany('user', { async: true, inverse: 'company' }) users;
+ @hasMany('project', { async: true }) projects;
+}
diff --git a/tests/dummy/app/models/cool-stoner.js b/tests/dummy/app/models/cool-stoner.js
index a40fe202..fed0cbc0 100644
--- a/tests/dummy/app/models/cool-stoner.js
+++ b/tests/dummy/app/models/cool-stoner.js
@@ -1,3 +1,3 @@
import Stoner from './stoner';
-export default Stoner.extend();
+export default class extends Stoner {}
diff --git a/tests/dummy/app/models/department-employment.js b/tests/dummy/app/models/department-employment.js
index cb4dc15c..15bf16ad 100644
--- a/tests/dummy/app/models/department-employment.js
+++ b/tests/dummy/app/models/department-employment.js
@@ -2,8 +2,8 @@ import { attr } from '@ember-data/model';
import Fragment from 'ember-data-model-fragments/fragment';
import { fragment } from 'ember-data-model-fragments/attributes';
-export default Fragment.extend({
- startDate: attr('date'),
- endDate: attr('date'),
- department: fragment('department'),
-});
+export default class extends Fragment {
+ @attr('date') startDate;
+ @attr('date') endDate;
+ @fragment('department') department;
+}
diff --git a/tests/dummy/app/models/department.js b/tests/dummy/app/models/department.js
index 5853786a..0a18675b 100644
--- a/tests/dummy/app/models/department.js
+++ b/tests/dummy/app/models/department.js
@@ -2,10 +2,11 @@ import { attr } from '@ember-data/model';
import Fragment from 'ember-data-model-fragments/fragment';
import { fragmentArray } from 'ember-data-model-fragments/attributes';
-export default Fragment.extend({
- name: attr('string'),
- addresses: fragmentArray('nested-fragment/address', {
+export default class extends Fragment {
+ @attr('string') name;
+ @fragmentArray('nested-fragment/address', {
polymorphic: true,
typeKey: '$type',
- }),
-});
+ })
+ addresses;
+}
diff --git a/tests/dummy/app/models/dog.js b/tests/dummy/app/models/dog.js
index ee72fba2..610b695a 100644
--- a/tests/dummy/app/models/dog.js
+++ b/tests/dummy/app/models/dog.js
@@ -1,8 +1,8 @@
import Model, { attr, belongsTo } from '@ember-data/model';
-export default Model.extend({
- owner: belongsTo('person'),
- dogNumber: attr('string'),
- sound: attr('string'),
- tag: attr(), // hash
-});
+export default class extends Model {
+ @belongsTo('person') owner;
+ @attr('string') dogNumber;
+ @attr('string') sound;
+ @attr() tag; // hash
+}
diff --git a/tests/dummy/app/models/employee.js b/tests/dummy/app/models/employee.js
index ad507dc3..03b3ea87 100644
--- a/tests/dummy/app/models/employee.js
+++ b/tests/dummy/app/models/employee.js
@@ -5,12 +5,12 @@ import {
fragmentArray,
} from 'ember-data-model-fragments/attributes';
-export default Model.extend({
- designation: fragment('name'),
- name: fragment('name'),
- titles: array('string'),
- gender: attr('string'),
- birthDate: attr('date'),
- position: attr(),
- departmentEmployments: fragmentArray('department-employment'),
-});
+export default class extends Model {
+ @fragment('name') designation;
+ @fragment('name') name;
+ @array('string') titles;
+ @attr('string') gender;
+ @attr('date') birthDate;
+ @attr() position;
+ @fragmentArray('department-employment') departmentEmployments;
+}
diff --git a/tests/dummy/app/models/entry-type.js b/tests/dummy/app/models/entry-type.js
index ef895436..39ac6af2 100644
--- a/tests/dummy/app/models/entry-type.js
+++ b/tests/dummy/app/models/entry-type.js
@@ -1,6 +1,6 @@
import Model, { attr, hasMany } from '@ember-data/model';
-export default Model.extend({
- name: attr('string'),
- entries: hasMany('entry'),
-});
+export default class extends Model {
+ @attr('string') name;
+ @hasMany('entry') entries;
+}
diff --git a/tests/dummy/app/models/entry.js b/tests/dummy/app/models/entry.js
index 58d800a7..70fef1c4 100644
--- a/tests/dummy/app/models/entry.js
+++ b/tests/dummy/app/models/entry.js
@@ -1,6 +1,6 @@
import Model, { attr, belongsTo } from '@ember-data/model';
-export default Model.extend({
- name: attr('string'),
- entryType: belongsTo('entry-type'),
-});
+export default class extends Model {
+ @attr('string') name;
+ @belongsTo('entry-type') entryType;
+}
diff --git a/tests/dummy/app/models/fluffy-material.js b/tests/dummy/app/models/fluffy-material.js
index 09dde759..3ad9500e 100644
--- a/tests/dummy/app/models/fluffy-material.js
+++ b/tests/dummy/app/models/fluffy-material.js
@@ -1,10 +1,11 @@
import Material from './material';
import { belongsTo } from '@ember-data/model';
-export default Material.extend({
- hat: belongsTo('hat', {
+export default class extends Material {
+ @belongsTo('hat', {
async: false,
inverse: 'fluffyMaterials',
polymorphic: true,
- }),
-});
+ })
+ hat;
+}
diff --git a/tests/dummy/app/models/group.js b/tests/dummy/app/models/group.js
index 8a4477d0..5b90dd8d 100644
--- a/tests/dummy/app/models/group.js
+++ b/tests/dummy/app/models/group.js
@@ -1,17 +1,19 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- type: attr('string', { defaultValue: 'Group' }),
- name: attr('string'),
- profiles: hasMany('profile', { async: false, inverse: 'group' }),
- versions: hasMany('group', {
+export default class extends Model {
+ @attr('string', { defaultValue: 'Group' }) type;
+ @attr('string') name;
+ @hasMany('profile', { async: false, inverse: 'group' }) profiles;
+ @hasMany('group', {
async: false,
polymorphic: true,
inverse: 'group',
- }),
- group: belongsTo('group', {
+ })
+ versions;
+ @belongsTo('group', {
async: false,
polymorphic: true,
inverse: 'versions',
- }),
-});
+ })
+ group;
+}
diff --git a/tests/dummy/app/models/hat.js b/tests/dummy/app/models/hat.js
index 44b7b2ee..655282bb 100644
--- a/tests/dummy/app/models/hat.js
+++ b/tests/dummy/app/models/hat.js
@@ -1,11 +1,11 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- type: attr('string'),
- shape: attr('string'),
- user: belongsTo('user', { async: false, inverse: 'hats' }),
- outfit: belongsTo('outfit', { async: false, inverse: 'hats' }),
- hat: belongsTo('hat', { async: false, inverse: 'hats', polymorphic: true }),
- hats: hasMany('hat', { async: false, inverse: 'hat', polymorphic: true }),
- fluffyMaterials: hasMany('fluffy-material', { async: false, inverse: 'hat' }),
-});
+export default class extends Model {
+ @attr('string') type;
+ @attr('string') shape;
+ @belongsTo('user', { async: false, inverse: 'hats' }) user;
+ @belongsTo('outfit', { async: false, inverse: 'hats' }) outfit;
+ @belongsTo('hat', { async: false, inverse: 'hats', polymorphic: true }) hat;
+ @hasMany('hat', { async: false, inverse: 'hat', polymorphic: true }) hats;
+ @hasMany('fluffy-material', { async: false, inverse: 'hat' }) fluffyMaterials;
+}
diff --git a/tests/dummy/app/models/mailing-address.js b/tests/dummy/app/models/mailing-address.js
index 9bc2f098..7fb23d38 100644
--- a/tests/dummy/app/models/mailing-address.js
+++ b/tests/dummy/app/models/mailing-address.js
@@ -1,6 +1,6 @@
import { attr } from '@ember-data/model';
import Address from 'dummy/models/nested-fragment/address';
-export default Address.extend({
- mailingAddressProperty: attr('number'),
-});
+export default class extends Address {
+ @attr('number') mailingAddressProperty;
+}
diff --git a/tests/dummy/app/models/manager.js b/tests/dummy/app/models/manager.js
index 4d2ecab0..8ac8485f 100644
--- a/tests/dummy/app/models/manager.js
+++ b/tests/dummy/app/models/manager.js
@@ -1,8 +1,8 @@
import Model, { hasMany, belongsTo } from '@ember-data/model';
import { fragment } from 'ember-data-model-fragments/attributes';
-export default Model.extend({
- name: fragment('name'),
- salary: belongsTo('salary'),
- reviews: hasMany('review'),
-});
+export default class extends Model {
+ @fragment('name') name;
+ @belongsTo('salary') salary;
+ @hasMany('review') reviews;
+}
diff --git a/tests/dummy/app/models/material.js b/tests/dummy/app/models/material.js
index 0deeb15b..72c1d3da 100644
--- a/tests/dummy/app/models/material.js
+++ b/tests/dummy/app/models/material.js
@@ -1,5 +1,5 @@
import Model, { attr } from '@ember-data/model';
-export default Model.extend({
- name: attr('string'),
-});
+export default class extends Model {
+ @attr('string') name;
+}
diff --git a/tests/dummy/app/models/name.js b/tests/dummy/app/models/name.js
index 7ea53394..68cc76f6 100644
--- a/tests/dummy/app/models/name.js
+++ b/tests/dummy/app/models/name.js
@@ -1,7 +1,7 @@
import { attr } from '@ember-data/model';
import Fragment from 'ember-data-model-fragments/fragment';
-export default Fragment.extend({
- firstName: attr('string'),
- lastName: attr('string'),
-});
+export default class extends Fragment {
+ @attr('string') firstName;
+ @attr('string') lastName;
+}
diff --git a/tests/dummy/app/models/nested-fragment/address.js b/tests/dummy/app/models/nested-fragment/address.js
index 3203a459..99a898aa 100644
--- a/tests/dummy/app/models/nested-fragment/address.js
+++ b/tests/dummy/app/models/nested-fragment/address.js
@@ -1,9 +1,9 @@
import { attr } from '@ember-data/model';
import Fragment from 'ember-data-model-fragments/fragment';
-export default Fragment.extend({
- street: attr('string'),
- city: attr('string'),
- region: attr('string'),
- country: attr('string'),
-});
+export default class extends Fragment {
+ @attr('string') street;
+ @attr('string') city;
+ @attr('string') region;
+ @attr('string') country;
+}
diff --git a/tests/dummy/app/models/outfit.js b/tests/dummy/app/models/outfit.js
index 4f94b124..b3b96855 100644
--- a/tests/dummy/app/models/outfit.js
+++ b/tests/dummy/app/models/outfit.js
@@ -1,7 +1,7 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- name: attr('string'),
- person: belongsTo('person', { async: false, polymorphic: true }),
- hats: hasMany('hat', { async: false, polymorphic: true }),
-});
+export default class extends Model {
+ @attr('string') name;
+ @belongsTo('person', { async: false, polymorphic: true }) person;
+ @hasMany('hat', { async: false, polymorphic: true }) hats;
+}
diff --git a/tests/dummy/app/models/person.js b/tests/dummy/app/models/person.js
index 64cdc896..877c532c 100644
--- a/tests/dummy/app/models/person.js
+++ b/tests/dummy/app/models/person.js
@@ -1,10 +1,10 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- type: attr('string'),
- name: attr('string'),
- style: attr('string'),
- category: attr('string'),
- company: belongsTo('company', { async: false }),
- outfits: hasMany('outfit', { async: false }),
-});
+export default class extends Model {
+ @attr('string') type;
+ @attr('string') name;
+ @attr('string') style;
+ @attr('string') category;
+ @belongsTo('company', { async: false }) company;
+ @hasMany('outfit', { async: false }) outfits;
+}
diff --git a/tests/dummy/app/models/philosopher.js b/tests/dummy/app/models/philosopher.js
index 11e52968..82a509f1 100644
--- a/tests/dummy/app/models/philosopher.js
+++ b/tests/dummy/app/models/philosopher.js
@@ -1,3 +1,3 @@
import Person from './person';
-export default Person.extend();
+export default class extends Person {}
diff --git a/tests/dummy/app/models/profile.js b/tests/dummy/app/models/profile.js
index 1ed51ea0..ee532fcf 100644
--- a/tests/dummy/app/models/profile.js
+++ b/tests/dummy/app/models/profile.js
@@ -1,17 +1,18 @@
import Model, { attr, belongsTo } from '@ember-data/model';
-export default Model.extend({
- created_at: attr('date'),
- description: attr('string'),
- camelCaseDescription: attr('string'),
- snake_case_description: attr('string'),
- aBooleanField: attr('boolean'),
- foo: attr('just-a-string'),
- superHero: belongsTo('super-hero', { async: false }),
- company: belongsTo('company', { async: false }),
- group: belongsTo('group', {
+export default class extends Model {
+ @attr('date') created_at;
+ @attr('string') description;
+ @attr('string') camelCaseDescription;
+ @attr('string') snake_case_description;
+ @attr('boolean') aBooleanField;
+ @attr('just-a-string') foo;
+ @belongsTo('super-hero', { async: false }) superHero;
+ @belongsTo('company', { async: false }) company;
+ @belongsTo('group', {
async: false,
polymorphic: true,
inverse: 'profiles',
- }),
-});
+ })
+ group;
+}
diff --git a/tests/dummy/app/models/project.js b/tests/dummy/app/models/project.js
index 75d9adc2..fff63f7d 100644
--- a/tests/dummy/app/models/project.js
+++ b/tests/dummy/app/models/project.js
@@ -1,9 +1,9 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- title: attr('string'),
- user: belongsTo('user', { async: false }),
- manager: belongsTo('manager', { async: true }),
- parent: belongsTo('project', { async: false, inverse: 'children' }),
- children: hasMany('project', { async: false, inverse: 'parent' }),
-});
+export default class extends Model {
+ @attr('string') title;
+ @belongsTo('user', { async: false }) user;
+ @belongsTo('manager', { async: true }) manager;
+ @belongsTo('project', { async: false, inverse: 'children' }) parent;
+ @hasMany('project', { async: false, inverse: 'parent' }) children;
+}
diff --git a/tests/dummy/app/models/property.js b/tests/dummy/app/models/property.js
index 9a86ddd8..532e86c9 100644
--- a/tests/dummy/app/models/property.js
+++ b/tests/dummy/app/models/property.js
@@ -1,7 +1,7 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- name: attr('string'),
- company: belongsTo('company', { async: true }),
- owners: hasMany('user', { async: true, inverse: 'properties' }),
-});
+export default class extends Model {
+ @attr('string') name;
+ @belongsTo('company', { async: true }) company;
+ @hasMany('user', { async: true, inverse: 'properties' }) owners;
+}
diff --git a/tests/dummy/app/models/review.js b/tests/dummy/app/models/review.js
index 35a7be89..161064d0 100644
--- a/tests/dummy/app/models/review.js
+++ b/tests/dummy/app/models/review.js
@@ -1,6 +1,6 @@
import Model, { attr } from '@ember-data/model';
-export default Model.extend({
- rating: attr('number'),
- date: attr('date'),
-});
+export default class extends Model {
+ @attr('number') rating;
+ @attr('date') date;
+}
diff --git a/tests/dummy/app/models/rod.js b/tests/dummy/app/models/rod.js
index 4c8521d1..2cfe2c5c 100644
--- a/tests/dummy/app/models/rod.js
+++ b/tests/dummy/app/models/rod.js
@@ -1,5 +1,5 @@
import Model, { attr } from '@ember-data/model';
-export default Model.extend({
- element: attr('element', { as_symbol: true }),
-});
+export default class extends Model {
+ @attr('element', { as_symbol: true }) element;
+}
diff --git a/tests/dummy/app/models/salary.js b/tests/dummy/app/models/salary.js
index e56524d7..11981acc 100644
--- a/tests/dummy/app/models/salary.js
+++ b/tests/dummy/app/models/salary.js
@@ -1,7 +1,7 @@
import Model, { attr } from '@ember-data/model';
import { array } from 'ember-data-model-fragments/attributes';
-export default Model.extend({
- income: attr('number'),
- benefits: array('string'),
-});
+export default class extends Model {
+ @attr('number') income;
+ @array('string') benefits;
+}
diff --git a/tests/dummy/app/models/small-company.js b/tests/dummy/app/models/small-company.js
index c2073198..002af599 100644
--- a/tests/dummy/app/models/small-company.js
+++ b/tests/dummy/app/models/small-company.js
@@ -1,8 +1,8 @@
import Company from './company';
import { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Company.extend({
- type: attr('string', { defaultValue: 'SmallCompany' }),
- owner: belongsTo('user', { async: true }),
- projects: hasMany('project', { async: false }),
-});
+export default class extends Company {
+ @attr('string', { defaultValue: 'SmallCompany' }) type;
+ @belongsTo('user', { async: true }) owner;
+ @hasMany('project', { async: false }) projects;
+}
diff --git a/tests/dummy/app/models/small-group.js b/tests/dummy/app/models/small-group.js
index 0890f7e6..7ef92afc 100644
--- a/tests/dummy/app/models/small-group.js
+++ b/tests/dummy/app/models/small-group.js
@@ -1,6 +1,6 @@
import Group from './group';
import { attr } from '@ember-data/model';
-export default Group.extend({
- type: attr('string', { defaultValue: 'SmallGroup' }),
-});
+export default class extends Group {
+ @attr('string', { defaultValue: 'SmallGroup' }) type;
+}
diff --git a/tests/dummy/app/models/small-hat.js b/tests/dummy/app/models/small-hat.js
index fb9c372a..4a0ed9bb 100644
--- a/tests/dummy/app/models/small-hat.js
+++ b/tests/dummy/app/models/small-hat.js
@@ -1,6 +1,6 @@
import Hat from './hat';
import { hasMany } from '@ember-data/model';
-export default Hat.extend({
- materials: hasMany('material', { polymorphic: true }),
-});
+export default class extends Hat {
+ @hasMany('material', { polymorphic: true }) materials;
+}
diff --git a/tests/dummy/app/models/soft-material.js b/tests/dummy/app/models/soft-material.js
index da6ef2df..883a89db 100644
--- a/tests/dummy/app/models/soft-material.js
+++ b/tests/dummy/app/models/soft-material.js
@@ -1,6 +1,6 @@
import Material from './material';
import { belongsTo } from '@ember-data/model';
-export default Material.extend({
- hat: belongsTo('big-hat', { async: false }),
-});
+export default class extends Material {
+ @belongsTo('big-hat', { async: false }) hat;
+}
diff --git a/tests/dummy/app/models/stoner.js b/tests/dummy/app/models/stoner.js
index 11e52968..82a509f1 100644
--- a/tests/dummy/app/models/stoner.js
+++ b/tests/dummy/app/models/stoner.js
@@ -1,3 +1,3 @@
import Person from './person';
-export default Person.extend();
+export default class extends Person {}
diff --git a/tests/dummy/app/models/super-hero.js b/tests/dummy/app/models/super-hero.js
index 11e52968..82a509f1 100644
--- a/tests/dummy/app/models/super-hero.js
+++ b/tests/dummy/app/models/super-hero.js
@@ -1,3 +1,3 @@
import Person from './person';
-export default Person.extend();
+export default class extends Person {}
diff --git a/tests/dummy/app/models/user.js b/tests/dummy/app/models/user.js
index f99cac0f..57efad9d 100644
--- a/tests/dummy/app/models/user.js
+++ b/tests/dummy/app/models/user.js
@@ -1,20 +1,20 @@
-import { computed } from '@ember/object';
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
-export default Model.extend({
- name: attr('string'),
- style: attr(), // purposely leave this blank just for making sure these attr types work
- info: attr('object'),
- company: belongsTo('company', {
+export default class extends Model {
+ @attr('string') name;
+ @attr() style; // purposely leave this blank just for making sure these attr types work
+ @attr('object') info;
+ @belongsTo('company', {
async: true,
inverse: 'users',
polymorphic: true,
- }),
- properties: hasMany('property', { async: true, inverse: 'owners' }),
- projects: hasMany('project', { async: false }),
- hats: hasMany('hat', { async: false, polymorphic: true }),
+ })
+ company;
+ @hasMany('property', { async: true, inverse: 'owners' }) properties;
+ @hasMany('project', { async: false }) projects;
+ @hasMany('hat', { async: false, polymorphic: true }) hats;
- funnyName: computed('name', function () {
+ get funnyName() {
return 'funny ' + this.name;
- }),
-});
+ }
+}
diff --git a/tests/dummy/app/models/villain.js b/tests/dummy/app/models/villain.js
index 11e52968..82a509f1 100644
--- a/tests/dummy/app/models/villain.js
+++ b/tests/dummy/app/models/villain.js
@@ -1,3 +1,3 @@
import Person from './person';
-export default Person.extend();
+export default class extends Person {}
diff --git a/tests/dummy/app/routes/application.js b/tests/dummy/app/routes/application.js
index b9e2cdfe..7d62f894 100644
--- a/tests/dummy/app/routes/application.js
+++ b/tests/dummy/app/routes/application.js
@@ -1,3 +1,3 @@
import Route from '@ember/routing/route';
-export default Route.extend();
+export default class extends Route {}
diff --git a/tests/dummy/app/routes/cats.js b/tests/dummy/app/routes/cats.js
index d0cedd14..a0afd2b2 100644
--- a/tests/dummy/app/routes/cats.js
+++ b/tests/dummy/app/routes/cats.js
@@ -1,7 +1,7 @@
import Route from '@ember/routing/route';
-export default Route.extend({
- model: function () {
+export default class extends Route {
+ model() {
return this.store.findAll('cat');
- },
-});
+ }
+}
diff --git a/tests/dummy/app/routes/employees.js b/tests/dummy/app/routes/employees.js
index d09f667b..7d62f894 100644
--- a/tests/dummy/app/routes/employees.js
+++ b/tests/dummy/app/routes/employees.js
@@ -1,3 +1,3 @@
import Route from '@ember/routing/route';
-export default Route.extend({});
+export default class extends Route {}
diff --git a/tests/dummy/app/routes/profiles.js b/tests/dummy/app/routes/profiles.js
index 904c7335..005d41eb 100644
--- a/tests/dummy/app/routes/profiles.js
+++ b/tests/dummy/app/routes/profiles.js
@@ -1,7 +1,7 @@
import Route from '@ember/routing/route';
-export default Route.extend({
- model: function () {
+export default class extends Route {
+ model() {
return this.store.findAll('profile');
- },
-});
+ }
+}
diff --git a/tests/dummy/app/routes/search.js b/tests/dummy/app/routes/search.js
index b9e2cdfe..7d62f894 100644
--- a/tests/dummy/app/routes/search.js
+++ b/tests/dummy/app/routes/search.js
@@ -1,3 +1,3 @@
import Route from '@ember/routing/route';
-export default Route.extend();
+export default class extends Route {}
diff --git a/tests/dummy/app/routes/search/results.js b/tests/dummy/app/routes/search/results.js
index 1c6f90f7..8de03033 100644
--- a/tests/dummy/app/routes/search/results.js
+++ b/tests/dummy/app/routes/search/results.js
@@ -1,14 +1,7 @@
import Route from '@ember/routing/route';
-export default Route.extend({
+export default class extends Route {
model(params) {
return this.store.query('user', { name: params.name }).catch((e) => e);
- },
-
- setupController(controller, users) {
- let { meta = {} } = users;
- controller.set('model', users);
- controller.set('previousPage', meta.previous);
- controller.set('nextPage', meta.next);
- },
-});
+ }
+}
diff --git a/tests/dummy/app/routes/user.js b/tests/dummy/app/routes/user.js
index c0ae5380..99c56ce4 100644
--- a/tests/dummy/app/routes/user.js
+++ b/tests/dummy/app/routes/user.js
@@ -1,7 +1,7 @@
import Route from '@ember/routing/route';
-export default Route.extend({
- model: function (params) {
+export default class extends Route {
+ model(params) {
return this.store.findRecord('user', params.user_id).catch(() => null);
- },
-});
+ }
+}
diff --git a/tests/dummy/app/routes/users.js b/tests/dummy/app/routes/users.js
index 056c2f8c..b7626047 100644
--- a/tests/dummy/app/routes/users.js
+++ b/tests/dummy/app/routes/users.js
@@ -1,7 +1,7 @@
import Route from '@ember/routing/route';
-export default Route.extend({
- model: function () {
+export default class extends Route {
+ model() {
return this.store.findAll('user');
- },
-});
+ }
+}
diff --git a/tests/dummy/app/serializers/application.js b/tests/dummy/app/serializers/application.js
index 0893da28..33d31a20 100644
--- a/tests/dummy/app/serializers/application.js
+++ b/tests/dummy/app/serializers/application.js
@@ -1,3 +1,3 @@
import JSONAPISerializer from '@ember-data/serializer/json-api';
-export default JSONAPISerializer.extend();
+export default class extends JSONAPISerializer {}
diff --git a/tests/dummy/app/serializers/manager.js b/tests/dummy/app/serializers/manager.js
index cf4caf3e..707ba4aa 100644
--- a/tests/dummy/app/serializers/manager.js
+++ b/tests/dummy/app/serializers/manager.js
@@ -2,8 +2,8 @@ import RESTSerializer, {
EmbeddedRecordsMixin,
} from '@ember-data/serializer/rest';
-export default RESTSerializer.extend(EmbeddedRecordsMixin, {
- attrs: {
+export default class extends RESTSerializer.extend(EmbeddedRecordsMixin) {
+ attrs = {
salary: {
serialize: true,
deserialize: 'records',
@@ -12,9 +12,9 @@ export default RESTSerializer.extend(EmbeddedRecordsMixin, {
serialize: true,
deserialize: 'records',
},
- },
+ };
keyForAttribute() {
- return this._super(...arguments);
- },
-});
+ return super.keyForAttribute(...arguments);
+ }
+}
diff --git a/tests/dummy/app/serializers/name.js b/tests/dummy/app/serializers/name.js
index 31e78e08..4918c7a9 100644
--- a/tests/dummy/app/serializers/name.js
+++ b/tests/dummy/app/serializers/name.js
@@ -1,8 +1,8 @@
import RESTSerializer from '@ember-data/serializer/rest';
import { decamelize } from '@ember/string';
-export default RESTSerializer.extend({
+export default class extends RESTSerializer {
keyForAttribute(attr) {
return decamelize(attr);
- },
-});
+ }
+}
diff --git a/tests/dummy/app/serializers/profile.js b/tests/dummy/app/serializers/profile.js
index 8c2b54b2..6dad3123 100644
--- a/tests/dummy/app/serializers/profile.js
+++ b/tests/dummy/app/serializers/profile.js
@@ -1,11 +1,11 @@
import JSONAPISerializer from '@ember-data/serializer/json-api';
-export default JSONAPISerializer.extend({
- transformFor: function (attributeType) {
+export default class extends JSONAPISerializer {
+ transformFor(attributeType, ...args) {
if (attributeType === 'just-a-string') {
return this.container.lookup('transform:string');
} else {
- return this._super.apply(this, arguments);
+ return super.transformFor(attributeType, ...args);
}
- },
-});
+ }
+}
diff --git a/tests/dummy/app/templates/cats.hbs b/tests/dummy/app/templates/cats.hbs
index 5a490fcd..41ded482 100644
--- a/tests/dummy/app/templates/cats.hbs
+++ b/tests/dummy/app/templates/cats.hbs
@@ -1 +1 @@
-{{animal-list animals=this.model species='cat'}}
+