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

Make template lookup more confident #60

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

julianrubisch
Copy link
Contributor

By trying to get a template matching self.class.name.underscore first.

This fixes inline rendered views (i.e., without a top-level view file)

@joshleblanc
Copy link
Owner

That method is actually looking for the template that rendered the component, not the template that the component renders.

It's the differeniate between different component instances

# index.html.erb

<%= render MyComponent.new %> # index.html.erb:1 <- unique identifier
<% render MyComponent.new %> # index.html.erb:2 <- unique identifier

@julianrubisch
Copy link
Contributor Author

Hmmm so I need to approach that differently.

Any idea what could work?

@joshleblanc
Copy link
Owner

Providing the key manually through collection_key is the only solution I've come up with so far. It's something I wnated to solve for Ilex, but I haven't had any good thoughts so far.

My knee-jerk reaction is to just always use second call in the call stack, because that's always going to be what's rendering the component, but I seem to recall trying that initially and running into problems. It might have had something to do with debuggers not playing nicely...

Definitely something to check

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

Successfully merging this pull request may close these issues.

2 participants