Categories
Code learning rails ruby

ActiveAdmin on Heroku (Rails 3.1)

I wrote a post detailing some issues I had with ActiveAdmin and Heroku with Rails 3.1.

It’s probably entirely out of date, but in case its of any use for you, it’s still archived here.

Just a brief note on getting the new ActiveAdmin gem working with Heroku under Rails 3.1 (on Thin and probably some other servers too)

ActiveAdmin looks like a really useful tool to avoid Scaffold-itis when it comes to admin interfacing in Rails apps. You install the gem and loosely define what models you’re using; and you can create simple effective dashboards.

It works easily on local testing, but when you deploy to production on Heroku (or locally with thin $ bundle exec rails server thin -e production the build will fail citing /Users/dave/.rvm/gems/ruby-1.9.2-p290/gems/sass-rails-3.1.0/lib/sass/rails/railtie.rb:38:in `block in ': uninitialized constant Sass::Rails::SassTemplate (NameError)… or similar.

By default the SASS gem is defined within ‘assets’ in the Gemfile.  Move the line


group :assets do
gem 'sass-rails', " ~> 3.1.0"
..
end

outside the assets group, and it will spin up without a problem. It seems the assets group is processed after other gems.

Solution found via this post: https://github.com/rails/sass-rails/issues/38
Great introductory ActiveAdmin tutorial at Railscasts

Now to actually build the dashboard…

 

POST UPDATED 2012-02-16

Other issues can be found here: https://github.com/gregbell/active_admin/issues/474 — I was having issues with asset precompile interfering failing with ActiveAdmin (and I’ll admit, a single magic database number value within my codebase).

The solution to this issue was as benatkin pointed out, adding this within the ROUTES file tempers things:

break if ARGV.join.include? 'assets:precompile'

Not sure if it’s good practice but it gets around an annoying conflict with devise and activeadmin.

Edit ends.