active_admin is a cool gem for quickly creating an admin interface over your Active Record models. By default, it puts it’s JS and CSS files into your app/assets folder which then get included in your application. Not what you want.
Excluding active_admin.js and active_admin.css.scss
Create the folders
app/assets/stylesheets/admin and move the files
active_admin.css.scss into these folders, respectively.
app/assets/stylesheets/application.css.scss you will find the following near the top:
Change this to:
Do the same for
This changes what’s included in application.css from anything under the stylesheets folder (and it’s subfolders) and the contents of the application.css.scss file to only files directly under the stylesheets folder and the contents of the application.css.scss file. You should notice the active_admin files no longer being included. However, they are also no longer in active admin either.
Re-including the files in active admin
The culprit is active_admin’s asset_registration.rb and application.rb:
1 2 3 4
To clear these and replace them with the new files, add the following to the bottom of config/initializers/active_admin.rb:
1 2 3 4 5
Active admin should be back to normal.
Heroku deployment problems
When deploying to heroku, you may see something like this in the logs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
The files need to be precompiled for production, as noted in this issue. Add the following to
application.rb (or config file of choice):