[Fix] Rails Admin - undefined local variable or method javascript_importmap_shim_nonce_configuration_tag
After updating Ruby Gems, an error occurred on the Rails Admin page. undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908> NameError in R...
·1 min. read
Share
This content has been automatically translated from Ukrainian.
After updating Ruby Gems, an error occurred on the Rails Admin page.
undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908>
NameError in RailsAdmin::Main#dashboard
Showing /Users/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rails_admin-3.1.2/app/views/layouts/rails_admin/_head.html.erb where line #22 raised:
undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908>
Extracted source (around line #22):
undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908>
This happened due to the update to the major version of importmap-rails.
importmap-rails оновлення
So currently the simplest fix is to lock the version in the Gemfile:
gem "importmap-rails", "~> 1.1.5"
Then:
bundle install
And Rails Admin should work. I haven't read in detail the benefits of updating to importmap-rails, but evidently Rails Admin does not currently support this version. So we need to wait a bit for the update of this library.