ActionView::Template::Error (active_admin.css isn’t precompiled)

Just sepnt quite some time fixing infamous “ActionView::Template::Error (active_admin.css isn’t precompiled)” error on prod. Everything worked fine in dev environment but once I put the code on prod it broke. Couple websites proposed several solutions, but none of them worked for me. Finally a combination of difference recipes seemed to fix the problem. Here is how …

First edit config/environments/production.rb and add these lines to the end:

config.assets.precompile += %w(*.js)
config.assets.precompile += [/^[^_]\w+\.(css|css.scss)$/]
config.assets.precompile += %w( active_admin.css active_admin.js active_admin/print.css )

Next, run this commeand:

rake assets:precompile

Finally restart the web server and enjoy the problem gone :)

Leave a Reply