We override a page which has this virtual path: layouts/base
and we have an helper method which is named view_layouts_base_sidebar_hook_response (in the ApplicationHelper module).
As this helper method is a method of ActionView::Base, it matches this test:
ActionView::Base.instance_methods.detect { |name| name =~ /#{args[:virtual_path].gsub(/[^a-z_]/, '_')}/ }
and the application sees it as a compiled template.
We could at least restrict the regex to check string boundaries: /\b#{args[:virtual_path].gsub(/[^a-z_]/, '_')}\b/
But the error could still happen if we had, for instance, a layouts/base path and a layouts_base helper method.
Hi I encounter an error with my Rails 5.2 app since this commit: https://github.com/spree/deface/commit/0761a26f722741ba67da121e38efd262fe12b3b9
We override a page which has this virtual path:
layouts/base
and we have an helper method which is namedview_layouts_base_sidebar_hook_response
(in the ApplicationHelper module).As this helper method is a method of ActionView::Base, it matches this test:
ActionView::Base.instance_methods.detect { |name| name =~ /#{args[:virtual_path].gsub(/[^a-z_]/, '_')}/ }
and the application sees it as a compiled template.We could at least restrict the regex to check string boundaries:
/\b#{args[:virtual_path].gsub(/[^a-z_]/, '_')}\b/
But the error could still happen if we had, for instance, a
layouts/base
path and alayouts_base
helper method.It seems that, in Rails 6, CompiledTemplates will be available in ActionDispatch::DebugView (if I understand well this commit from @tenderlove: https://github.com/rails/rails/commit/f9bea6304dfba902b1937b3bc29b1ebc2f67e55b). If it's the case, it may help.
Thank you for your work.