« All deprecation guides

Deprecation Guide for Deprecate Model Reopen

until: 5.0
id: ember-data:deprecate-model-reopen

For properties known ahead of time, instead of:

class User extends Model {
  @attr firstName;
}

User.reopen({ lastName: attr() });

Extend User again or include it in the initial definition:

class User extends Model {
  @attr firstName;
  @attr lastName;
}

For properties generated dynamically, consider registering a SchemaDefinitionService with the store, as such services are capable of dynamically adjusting their schemas, and utilize the instantiateRecord hook to create a Proxy based class that can react to the changes in the schema. Use Foo extends Model to extend your class instead.