Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having two template names, one plural one singular, ignores plural #14944

Closed
Alonski opened this issue Feb 20, 2017 · 7 comments
Closed

Having two template names, one plural one singular, ignores plural #14944

Alonski opened this issue Feb 20, 2017 · 7 comments

Comments

@Alonski
Copy link
Member

Alonski commented Feb 20, 2017

I have two different routes:

  1. Template
  2. Templates

This also generated two templates:

  1. template.hbs
  2. templates.hbs

When I go to the templates route. Ember tries to render the template.hbs template.
pasted image at 2017_02_20 02_32 pm

Trying to use templateName or renderTemplate() doesn't work.
// app/routes/templates.js export default Ember.Route.extend({ templateName: "templates", renderTemplate() { this.render("templates"); } });

Here is a twiddle made by @gmarquet
https://ember-twiddle.com/c3f1c16b8fb0ca56248b767a09acd3c9?openFiles=twiddle.json%2C&route=%2Ftemplates

Got around this currently by renaming the template.hbs to something else and using templateName to set the name for the the template route

@pixelhandler
Copy link
Contributor

@Alonski it may be worth sharing a work around example as well. I see the issue in the ember-twiddle example you provided, this looks like a bug.

@Alonski
Copy link
Member Author

Alonski commented Mar 17, 2017

@pixelhandler Hey my workaround was renaming template.hbs to template-single.hbs. Then in the tenplateRoute I have templateName: template-single.hbs.

@locks
Copy link
Contributor

locks commented Mar 18, 2017

This is likely related to pods.

@Alonski
Copy link
Member Author

Alonski commented Mar 18, 2017

@locks To clarify I am not using pods in my App.

@locks
Copy link
Contributor

locks commented Mar 18, 2017

@Alonski the thing is that the resolver supports both structures at the same time, and as far as I know there's no way to "turn it off", so indirectly you are using pods ;x

What I think is happening here, since you don't have a "pod module prefix" set, it falls back to /app, meaning /app/templates/template.hbs translates to "this is the template file for the templates route". Could you confirm @rwjblue?

The good news is that the module unification structure should not suffer from these kinds of ambiguity.

@locks locks self-assigned this Apr 20, 2017
@pixelhandler
Copy link
Contributor

@Alonski yeah I was suspicious of the name template.hbs glad you had a work around using template-single.hbs. I'll close this for now.

@Alonski
Copy link
Member Author

Alonski commented Nov 3, 2017

@pixelhandler I'm not sure this should be closed. Maybe add a workaround in the CLI so you can't create templates named template.hbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants