Rails 7 ActionView::MissingTemplate error

Error finding partials with rails 7.0, rails 6.1 works fine.

ActionView::Template::Error (Missing partial admin/request_templates/_index.js.haml, ajax/_index.js.haml, application/_index.js.haml with {:locale=>[:es], :formats=>[:html], :variants=>, :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder, :haml]}.

In rails 7, there are many new ways to handle Javascript: webpack, rollup, esbuild and importmap.

Using _index.js.haml used to be a way to build dynamic javascript files at run time, pulling some data from the backend and changing the content of the javascript file depending the circumstances.

Such “on the fly” javavascript update can not work with Rails 7 since all the javascript is now frozen when you deploy the application.