Skip to content

Commit

Permalink
Merge pull request #76 from simonihmig/assert-model
Browse files Browse the repository at this point in the history
Add assertion for not passing @model and @models to <LinkTo>
  • Loading branch information
rwjblue authored Jul 14, 2019
2 parents 2d43783 + da611c9 commit 7cacd37
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ast-link-to-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class AngleBracketLinkToPolyfill {
let models = attributes.find(({ name }) => name === '@models');
let query = attributes.find(({ name }) => name === '@query');

if (model && models) {
throw new Error(
'You cannot provide both the `@model` and `@models` arguments to the <LinkTo> component.'
);
}

let needsParamsHelper =
(models && models.value.path.original !== 'array') ||
(query && query.value.path.original !== 'hash');
Expand Down

0 comments on commit 7cacd37

Please sign in to comment.