@belgoros wrote:
I can’t figure out what is the convention rule in the when querring in
model
hook in a route handler. How Ember knows which URL to hit in the following situation:Here is my router definition:
#router.js Router.map(function() { ... this.route('languages', { path: '/shops/:shop_id/languages'}); });
Here the link definition in a template:
#application.hbs {{#link-to 'languages' currentUser.user.shop.id class="nav-link"}}...{{/link-to}}
Here the route handler:
#languages.js export default Route.extend(AuthenticatedRouteMixin, { model(params) { return this.store.query('language', { shop: params.shop_id }) } });
I hoped that Ember to hit
shops/:shop_id/languages
URL, but it did/languages?shop=6449
instead. Can somebody explain me the role oflanguage
String inthis.store.query('language', { shop: params.shop_id })
, - I belived that Ember would just deserializelanguage
model (defined inmodels/language.js
). Thank you.
Posts: 6
Participants: 4