Ruby on rails and active_admin assets on Heroku
If you are using heroku you probably ran into some issues with
rake assets:precompile. When using active admin bringing it's assets into your app can also be quite tricky.
The method of precompiling your assets yourself and adding them to your git repository works for sure but it isn't really best practice.
Another way to get the needed assets to be compiled is as foll
- Configure the
config.assets.initialize_on_precompile = falseif you don't have it already (refer to the heroku faq).
config/application.rband require the
:assetsgroup with bundler.
- Add the line
config.assets.precompile += %w( active_admin.css active_admin/print.css active_admin.js )also to your
Be sure to write
active_admin.css and not
active_admin.css.scss in the
config/application.rb ... if defined?(Bundler) # If you precompile assets before deploying to production, use this line # Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line Bundler.require(:default, :assets, Rails.env) end module Bildungsnetz class Application < Rails::Application ... # Enable the asset pipeline config.assets.enabled = true # Disable application initialize on precompile (heroku faq: fixes database access error on precompile) config.assets.initialize_on_precompile = false # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) config.assets.precompile += %w( active_admin.css active_admin/print.css active_admin.js ) ... end end