Ember navigates to a show route, GETs the wrong URL (/tools instead of /tools/1)

62 views Asked by At

I have a conventional Ember CLI app, and a conventional show route:

export default Ember.Route.extend({
  model: function(params) {
    return this.store.find('tool', params.tool_id);
  }
});

But when I navigate to /tools/1, it GETs /tools instead of /tools/1! What am I doing wrong?

Extra info...

  • I'm using the --proxy http://127.0.0.1:3000 option to pass API requests to a Rails backend
  • The app is organized in pods
  • I have no custom adapters
  • I know the route is being reached because I can add .then(function() {debugger}) to the end of the promise and it gets hit
  • Link to repo: https://github.com/jasonbenn/toolbus-web
1

There are 1 answers

1
Kingpin2k On BEST ANSWER

The tool route is a parent to tools.show, so its model hook will also be hit in the process, and if the tool by that id is already fetched, it doesn't need to call your server again for tools/1