madebymany / sir-trevor-rails

Rails gem for Sir Trevor integration.
MIT License
149 stars 50 forks source link

Fix ViewResolver for Rails 6 #62

Open otagi opened 4 years ago

otagi commented 4 years ago

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 madebymany/sir-trevor-rails#61

cimm commented 1 year ago

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

atiro commented 1 year ago

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