ruby-on-railsadministrate

Rails 6 / Administrate : Sprocket error when installing administrate-field-nested_has_many


My app (Rails 6.1.3 / Administrate v0.16) was working before I tried to integrate the administrate-field-nested_has_many plugin.

I just added the gem and bundle, and now I get this error when I load any administrate page :

Sprockets::Rails::Helper::AssetNotPrecompiled in Admin::Users#index

Showing /app_path/app/views/admin/application/_stylesheet.html.erb where line #11 raised:
administrate-field-nested_has_many/application.css
Extracted source (around line #11):

9     
10    <% Administrate::Engine.stylesheets.each do |css_path| %>
11      <%= stylesheet_link_tag css_path %>
12    <% end %>
13

Application Trace | Framework Trace | Full Trace
app/views/admin/application/_stylesheet.html.erb:11
app/views/admin/application/_stylesheet.html.erb:10:in `each'
app/views/admin/application/_stylesheet.html.erb:10
app/views/layouts/admin/application.html.erb:24

Solution

  • This is a known issue with the current version of administrate-field-nested_has_many, and there's a PR currently in the queue that should solve it (see https://github.com/nickcharlton/administrate-field-nested_has_many/pull/45).

    For the time being, you should be able to work around the issue by adding the following lines to your manifest.js:

    // Add to app/assets/config/manifest.js
    //= link administrate-field-nested_has_many/application.js
    //= link administrate-field-nested_has_many/application.css