I have recently upgraded a project to ruby 3.2.2 and rails 6.1
I am having issues with ActionView::Base. With the recent upgrade, I need to pass 3 arguments to ActionView::Base.new instead of 2. From the docs, ActionView now receives lookup_context, assigns, controller
view = ActionView::Base.new(
ActionController::Base.view_paths,
{
client: client,
report: self.report,
},
nil
)
So I fixed it by passing nil (as shown above), but now I get a different error:
/usr/local/rvm/gems/ruby-3.2.2/gems/actionview-6.1.7.3/lib/action_view/base.rb:264:in `in_rendering_context': undefined method `html_fallback_for_js' for #<ActionView::PathSet:0x0000000110898f58 @paths=[#<ActionView::OptimizedFileSystemResolver:0x000000010fa92670 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @unbound_templates=#<Concurrent::Map:0x0000000110898f30 entries=0 default_proc=nil>, @path_parser=#<ActionView::Resolver::PathParser:0x0000000110898eb8>, @cache=#<ActionView::Resolver::Cache:0x0000000110898e90 keys=0 queries=0>, @path="/Users/Mari/reporting/app/views">, #<ActionView::OptimizedFileSystemResolver:0x000000010fa92760 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @unbound_templates=#<Concurrent::Map:0x00000001108994a8 entries=0 default_proc=nil>, @path_parser=#<ActionView::Resolver::PathParser:0x0000000110899408>, @cache=#<ActionView::Resolver::Cache:0x00000001108993e0 keys=0 queries=0>, @path="/usr/local/rvm/gems/ruby-3.2.2/gems/graphiql-rails-1.9.0/app/views">, #<ActionView::OptimizedFileSystemResolver:0x000000010fa92850 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @unbound_templates=#<Concurrent::Map:0x0000000110899ac0 entries=0 default_proc=nil>, @path_parser=#<ActionView::Resolver::PathParser:0x0000000110899a48>, @cache=#<ActionView::Resolver::Cache:0x0000000110899a20 keys=0 queries=0>, @path="/usr/local/rvm/gems/ruby-3.2.2/gems/teaspoon-1.2.2/app/views">, #<ActionView::OptimizedFileSystemResolver:0x000000010fa92940 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @unbound_templates=#<Concurrent::Map:0x0000000110899e80 entries=0 default_proc=nil>, @path_parser=#<ActionView::Resolver::PathParser:0x0000000110899e08>, @cache=#<ActionView::Resolver::Cache:0x0000000110899de0 keys=0 queries=0>, @path="/usr/local/rvm/gems/ruby-3.2.2/gems/devise-security-0.18.0/app/views">, #<ActionView::OptimizedFileSystemResolver:0x000000010fa92990 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @unbound_templates=#<Concurrent::Map:0x000000011089a268 entries=0 default_proc=nil>, @path_parser=#<ActionView::Resolver::PathParser:0x000000011089a1f0>, @cache=#<ActionView::Resolver::Cache:0x000000011089a1c8 keys=0 queries=0>, @path="/usr/local/rvm/gems/ruby-3.2.2/gems/devise-4.8.0/app/views">, #<ActionView::OptimizedFileSystemResolver:0x000000010fa929e0 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @unbound_templates=#<Concurrent::Map:0x000000011089a740 entries=0 default_proc=nil>, @path_parser=#<ActionView::Resolver::PathParser:0x000000011089a6c8>, @cache=#<ActionView::Resolver::Cache:0x000000011089a650 keys=0 queries=0>, @path="/usr/local/rvm/gems/ruby-3.2.2/gems/ckeditor-4.3.0/app/views">]> (NoMethodError)
if !lookup_context.html_fallback_for_js && options[:formats]
The actionview version is 6.1.7.3
In Rails 6.1
ActionView::Base.newtakes 3 arguments: lookup_context, assigns, controllerBut you passed
ActionView::PathSetinstance instead ofActionView::LookupContextThis object hasn't such getter, that's why you have error
Instead of this wrap path set into lookup context. Also in new Ruby don't need duplicate value if it's name is equal of key name
After that you can use this view for rendering