Skip to content

Commit

Permalink
Set inverse to remove deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmanuel committed May 30, 2023
1 parent fee69c6 commit 219f289
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/dummy/app/models/order-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Validations = buildValidations({
});

export default Model.extend(Validations, {
order: belongsTo('order', { async: true }),
selections: hasMany('order-selection', { async: true }),
order: belongsTo('order', { async: true, inverse: 'lines' }),
selections: hasMany('order-selection', { async: true, inverse: 'line' }),
type: attr('string'),
});
7 changes: 5 additions & 2 deletions tests/dummy/app/models/order-selection-question.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ const Validations = buildValidations(
);

export default Model.extend(Validations, {
order: belongsTo('order', { async: true }),
selection: belongsTo('order-selection', { async: true }),
order: belongsTo('order', { async: true, inverse: null }),
selection: belongsTo('order-selection', {
async: true,
inverse: 'questions',
}),
text: attr('string'),
});
9 changes: 6 additions & 3 deletions tests/dummy/app/models/order-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ const Validations = buildValidations({
});

export default Model.extend(Validations, {
order: belongsTo('order', { async: true }),
line: belongsTo('order-line', { async: true }),
questions: hasMany('order-selection-question', { async: true }),
order: belongsTo('order', { async: true, inverse: null }),
line: belongsTo('order-line', { async: true, inverse: 'selections' }),
questions: hasMany('order-selection-question', {
async: true,
inverse: 'selection',
}),
quantity: attr('number'),
});
2 changes: 1 addition & 1 deletion tests/dummy/app/models/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ const Validations = buildValidations({

export default Model.extend(Validations, {
source: attr('string'),
lines: hasMany('order-line', { async: true }),
lines: hasMany('order-line', { async: true, inverse: 'order' }),
});
2 changes: 1 addition & 1 deletion tests/dummy/app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ export default Model.extend(Validations, {
username: attr('string'),
password: attr('string'),
email: attr('string'),
details: belongsTo('user-detail'),
details: belongsTo('user-detail', { inverse: null }),
});
// END-SNIPPET

0 comments on commit 219f289

Please sign in to comment.