Order in `only` param matters
Closed this issue · 2 comments
adrianheine commented
If I call resources
with {only: ['index', 'show', 'new', 'create']}
, /resource/new
is interpreted as a show
request for id new
.
olalonde commented
This only happens when you use only
?
adrianheine commented
Looking at the code this seems to be the case, yes. The other options depend on the order the keys of availableRoutes
are iterated. This order is not guaranteed to be what you might expect, but it works in most if not all JS environments I know. Since order matters so much I would suggest to use an array, though.