Skip to content

Commit

Permalink
Explicit relationships options and ED store import (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAstapov authored Oct 15, 2024
1 parent af0e267 commit 9537b2b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/dummy/app/models/dog.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import Model, { attr, belongsTo } from '@ember-data/model';

export default class Dog extends Model {
@attr('string', { defaultValue: 'rough collie' }) breed;
@belongsTo('user') user;
@belongsTo('user', { async: true, inverse: 'dogs' }) user;
}
2 changes: 1 addition & 1 deletion tests/dummy/app/models/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export default class Profile extends Model {
@attr('string', { defaultValue: 'Bob' }) firstName;
@attr('string', { defaultValue: 'Ross' }) lastName;

@belongsTo('dog') pet;
@belongsTo('dog', { async: true, inverse: null }) pet;
}
4 changes: 2 additions & 2 deletions tests/dummy/app/models/sync-user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Model, { belongsTo, hasMany } from '@ember-data/model';

export default class SyncUser extends Model {
@belongsTo('profile', { async: false }) profile;
@hasMany('dog', { async: false }) dogs;
@belongsTo('profile', { async: false, inverse: null }) profile;
@hasMany('dog', { async: false, inverse: null }) dogs;
}
4 changes: 2 additions & 2 deletions tests/dummy/app/models/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Model, { belongsTo, hasMany } from '@ember-data/model';

export default class User extends Model {
@belongsTo('profile') profile;
@hasMany('dog') dogs;
@belongsTo('profile', { async: true, inverse: null }) profile;
@hasMany('dog', { async: true, inverse: 'user' }) dogs;
}
1 change: 1 addition & 0 deletions tests/dummy/app/services/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-data/store';

0 comments on commit 9537b2b

Please sign in to comment.