0
votes

I have these routes in my Ember.js app:

router.js

EmberRails.Router.map(function() {
  this.resource('stories', function () {
    this.resource('story', {path: '/:story_id'});
  });
});

And this is what my Ember Inspector outputs in the routes tab:

Application Routes

Now, in the "Template" column (second from right), Ember tells me where it expects the templates should be for the different Story resources. As you can see, it wants certain templates directly in the /templates directory, and some in /templates/stories. I can see no reason for this and personally I find it confusing and ridiculous.

Is there any way in Ember to use a Rails-style convention, like this:

Show ('story') - /templates/stories/show
Index - /templates/stories/index
Edit - /templates/stories/edit
etc..

1
If you want to nest inside stories you need to use 'this.route'. Change this.resource('story', {path: '/:story_id'}); with this.route('story', {path: '/:story_id'}); - blessenm
"Error while processing route: stories.index" "Assertion Failed: You specified the templateName stories for <EmberRails.StoriesView:ember405>, but it did not exist." @blessenm - Marco Prins

1 Answers

0
votes

You can use Ember CLI and it's pods feature to do this. It was recommended by the Ember core team that all Ember applications move to Ember CLI as soon as possible.

If you aren't or don't want to use Ember CLI, you can overwrite the regular Ember.DefaultResolver methods to change the resolver's functionality. There is a short example in the Docs.