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

Fix ViewResolver for Rails 6 #62

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

Conversation

otagi
Copy link

@otagi otagi commented Jul 14, 2020

Problem

ActionView::FileSystemResolver does not call find_templates anymore in version 6.0.

As a result, SirTrevorRails::ViewResolver#find_templates is never called.

It still works fine with simple controllers, but breaks when the controller has a namespace, e.g. Blog::PostsController. In that case, the resolver will prepend the namespace to the Sir Trevor block partial path, e.g. blog/sir_trevor/blocks/_text_block, and throw an ActionView::Template::Error: Missing partial exception.

Solution

Add SirTrevorRails::ViewResolver#_find_all, which is called by ActionView::FileSystemResolver v6. And leave find_templates for backward compatibility.

The integration tests are modified to use a controller namespace.

Fixes #61

@cimm
Copy link

cimm commented Oct 19, 2022

Any updates on this pull request? We are noticing the same in our Rails 6.1.7 application.

@atiro
Copy link

atiro commented Nov 10, 2022

+1, we would also like to be able to update this

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.

ActionView::MissingTemplate with namespaced controller in Rails 6
3 participants