@ember-data/model 4.12.0-alpha.19 → 4.12.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/addon/-private.js CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Model } from "./has-many-8b79f084";
2
- export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, P as PromiseBelongsTo, c as PromiseManyArray, a as attr, b as belongsTo, h as hasMany } from "./has-many-8b79f084";
1
+ import { M as Model } from "./has-many-465843f4";
2
+ export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, P as PromiseBelongsTo, c as PromiseManyArray, a as attr, b as belongsTo, h as hasMany } from "./has-many-465843f4";
3
3
  import { getOwner } from '@ember/application';
4
4
 
5
5
  /*
@@ -5581,6 +5581,7 @@ function normalizeType$1(type) {
5581
5581
  ```
5582
5582
 
5583
5583
  #### One-To-Many
5584
+
5584
5585
  To declare a one-to-many relationship between two models, use
5585
5586
  `belongsTo` in combination with `hasMany`, like this:
5586
5587
 
@@ -5588,31 +5589,18 @@ function normalizeType$1(type) {
5588
5589
  import Model, { hasMany } from '@ember-data/model';
5589
5590
 
5590
5591
  export default class PostModel extends Model {
5591
- @hasMany('comment') comments;
5592
- }
5593
- ```
5594
-
5595
- ```app/models/comment.js
5596
- import Model, { belongsTo } from '@ember-data/model';
5597
-
5598
- export default class CommentModel extends Model {
5599
- @belongsTo('post') post;
5592
+ @hasMany('comment', { async: false, inverse: 'post' }) comments;
5600
5593
  }
5601
5594
  ```
5602
5595
 
5603
- You can avoid passing a string as the first parameter. In that case Ember Data
5604
- will infer the type from the key name.
5605
-
5606
5596
  ```app/models/comment.js
5607
5597
  import Model, { belongsTo } from '@ember-data/model';
5608
5598
 
5609
5599
  export default class CommentModel extends Model {
5610
- @belongsTo post;
5600
+ @belongsTo('post', { async: false, inverse: 'comments' }) post;
5611
5601
  }
5612
5602
  ```
5613
5603
 
5614
- will lookup for a Post type.
5615
-
5616
5604
  #### Sync relationships
5617
5605
 
5618
5606
  Ember Data resolves sync relationships with the related resources
@@ -5624,7 +5612,8 @@ function normalizeType$1(type) {
5624
5612
 
5625
5613
  export default class CommentModel extends Model {
5626
5614
  @belongsTo('post', {
5627
- async: false
5615
+ async: false,
5616
+ inverse: null
5628
5617
  })
5629
5618
  post;
5630
5619
  }