Skip to content

Instantly share code, notes, and snippets.

@hoverlover
Created June 7, 2011 16:35
Show Gist options
  • Save hoverlover/1012619 to your computer and use it in GitHub Desktop.
Save hoverlover/1012619 to your computer and use it in GitHub Desktop.
Rails initializer for using ActiveAdmin with Sass on Heroku
if Rails.env.production?
require 'fileutils'
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets", "admin"))
template_path_one = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/app/assets/stylesheets"
template_path_two = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/lib/active_admin/sass"
old_compile_path = "#{Rails.root}/public/stylesheets/admin"
new_compile_path = "#{Rails.root}/tmp/stylesheets/admin"
Sass::Plugin::remove_template_location template_path_one
Sass::Plugin::add_template_location template_path_one, new_compile_path
Sass::Plugin::remove_template_location template_path_two
Sass::Plugin::add_template_location template_path_two, new_compile_path
end
@martinstreicher
Copy link

Does this error look familiar? I tried this patch to no avail.

ActionView::Template::Error (active_admin.css isn't precompiled):
2012-08-01T22:37:54+00:00 app[web.1]: 6: <title><%= [@page_title, active_admin_application.site_title].compact.join(" | ") %></title>
2012-08-01T22:37:54+00:00 app[web.1]: 7:
2012-08-01T22:37:54+00:00 app[web.1]: 8: <% ActiveAdmin.application.stylesheets.each do |style| %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment