You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When rendering a component in a subclass of ActionView::Base, methods called within the component are called on ActionView::Base instead of the subclass.
This prevents overriding methods on ActionView::Base in a subclass.
Steps to reproduce
# frozen_string_literal: true#require"bundler/inline"gemfile(true)dosource"https://rubygems.org"git_source(:github){ |repo| "https://github.com/#{repo}.git"}gem"rails","~> 7.0.0"gem"view_component"endrequire"action_view/railtie"require"action_view/testing/resolvers"classCustomView < ActionView::Basedefhi"Hi!"endendclassGreetingComponent < ViewComponent::Basedefcall# Calling `hi` directly doesn't work because ViewComponent::Base doesn't# inherit from ActionView::Base:## hi # raises: undefined method `hi' for #<GreetingComponent....#helpers.hiendendview_paths=[ActionView::FixtureResolver.new("main.erb"=>%Q{ <%= render GreetingComponent.new %> },)]custom_view=CustomView.with_empty_template_cache.with_view_pathsview_pathsputscustom_view.rendertemplate: 'main'
Expected behavior
Methods called in components rendered in a subclass of ActionView::Base delegate methods to the subclass.
Actual behavior
Methods called in components rendered in a subclass of ActionView::Base delegate methods to the ActionView::Base.
Methods defined on the subclass need to be called on the helper.
The text was updated successfully, but these errors were encountered:
When rendering a component in a subclass of ActionView::Base, methods called within the component are called on ActionView::Base instead of the subclass.
This prevents overriding methods on ActionView::Base in a subclass.
Steps to reproduce
Expected behavior
Methods called in components rendered in a subclass of ActionView::Base delegate methods to the subclass.
Actual behavior
Methods called in components rendered in a subclass of ActionView::Base delegate methods to the ActionView::Base.
Methods defined on the subclass need to be called on the
helper
.The text was updated successfully, but these errors were encountered: