-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
The render helper is not looking up controllers properly #2723
Comments
Seems to work with RC-4. Or am I missing something here? |
Your controller isn't in a namespace. I think this is actually still an issue. I think something like this should work, but I'm not exactly sure how you create a new namespace... |
This is still an issue from what I can tell. You're jsbin shows that it correctly pulls the template, but it doesn't run with the proper controller. This shows what I'm talking about: |
If you change your controller name to |
According to the Ember blog it should lookup Blog.IndexController. "This will render the blog/posts template with the controller Blog.PostsController." |
I'm pretty sure my commit was added before namespaces. We decided to treat slashes the same as dot notation for ease of use. With namespaces, this is no longer the behavior we want. The only risk to removing this is if people were relying on the slash notation for the dot notation behavior. Maybe someone could put an error handler in so that if the namespace doesn't exist then it tells people that they might want to try dot notation? |
@wagenet The error handler you mention would basically just inform the developer that slashes can't be used to delimit namespaces, and that she should use dots to achieve this, right? |
It seems to me that neither |
This is the only way I could get it to work. template: {{render "sidebar/user" model.user controller='app/Sidebar/User'}} controller: App.Sidebar ||= Ember.Namespace.create()
App.Sidebar.UserController = Ember.Controller.extend() |
Just a heads up, @stefanpenner decided not to merge @seanrucker's PR. We're doing some more in-depth overhauling of the container normalization which should cover this. |
we want to encapsulate the normalization rules to the resolver. So it will becomes easy to switch out as peoples module/resolution needs change. A side effect, is that we should be able to provide a defaultResolver with todays broken behaviour, for those that don't care. While allowing people to opt into a more modern resolver. |
An update, the resolver now encapsulates the normalization rules: b7fe725 This will allow us to continue to support the existing behaviour, but allow others to opt-in to a more consistent experience, like we do in EAK: https://github.com/stefanpenner/ember-app-kit/blob/master/vendor/loader.js#L41 As the slash clearly causes issues, we will likely see a different mechanism of declaring a namespace. The current thought is
or more related to the above issue, maybe something like: {{render 'posts@blog'}} |
it looks like we will add a flag, so people can toggle this behaviour. as '/' for namespace doesn't work anymore. Then we can transition people to a above described pattern |
@stefanpenner, does this even make sense anymore? |
So I'm not terribly motivated to hack a solution as in the new module world everything works wonderfully. At some point we should sort this out, but I don't have the time to fix this. If someone has time, I will give them advice |
Closing for now, but PRs are welcome. |
please aggregate this into "deprecate slash as namespace" |
See #5260 |
In the blog post announcing RC2 it specifically states with regard to the render helper that:
This is incorrect because the render helper is still using the old dot notation. Specifically this line is responsible for causing the lookup to fail:
https://github.com/emberjs/ember.js/blob/v1.0.0-rc.3/packages/ember-routing/lib/helpers/render.js#L43
Commenting out fixes the problem.
The text was updated successfully, but these errors were encountered: