davideisinger.com

My personal website
Log | Files | Refs | README

index.md (5031B)


      1 ---
      2 title: "Rails Admin Interface Generators"
      3 date: 2011-05-31T00:00:00+00:00
      4 draft: false
      5 canonical_url: https://www.viget.com/articles/rails-admin-interface-generators/
      6 ---
      7 
      8 Here at Viget, we're always looking for ways to reduce duplicated
      9 effort, and one component that nearly every single one of our
     10 applications needs is an admin interface. As such, we've spent a lot of
     11 time trying to find the perfect drop-in admin interface generator. We've
     12 been happy with [Typus](https://github.com/fesplugas/typus) for the past
     13 year or two and have been able to contribute back to the project on a
     14 [number](https://github.com/fesplugas/typus/commit/3fb53f58ce606ae80beaa712eef81dcf0d6b03bc)
     15 [of](https://github.com/fesplugas/typus/commit/b6ead488b218d187f948e85ec70c3b01a589ebae)
     16 [occasions](https://github.com/fesplugas/typus/commit/00b7b47ebd97a630623e80c006ef5401060bd848).
     17 Lately, though, a pair of new libraries have been making some noise:
     18 [ActiveAdmin](http://activeadmin.info/) and
     19 [RailsAdmin](https://github.com/sferik/rails_admin). How do they stack
     20 up to Typus? Read on, friend.
     21 
     22 ### Typus
     23 
     24 [Typus](https://github.com/fesplugas/typus) is a library by Francesc
     25 Esplugas originally started in 2007. Typus takes a different approach
     26 than the other two libraries in that it uses generated controllers that
     27 live in your Rails app to serve up its pages, rather than keeping all of
     28 its application code within the library. This approach offers (in this
     29 author's opinion) increased extensibility at the expense of code
     30 duplication --- it's dirt simple to override the (e.g.) `create` action
     31 in your `Admin::CommentsController` when the need arises, but you'll
     32 still need a separate controller for every model where the default
     33 behavior is good enough.
     34 
     35 Installing Typus is very straightforward: add the gem to your Gemfile,
     36 bundle it, run `rails generate typus` to get a basic admin interface up,
     37 then run `rails generate typus:migration` to get user authentication.
     38 The authors of the plugin recently fixed one of my biggest gripes,
     39 adding generators to make adding new admin controllers a snap.
     40 Configuration is all handled by a few YAML files. In terms of looks,
     41 Typus isn't going to win any awards out of the box, but they've made it
     42 very simple to copy the views into your app's `views/` folder, where
     43 you're free to override them.
     44 
     45 ### ActiveAdmin
     46 
     47 I just heard about [ActiveAdmin](http://activeadmin.info/) from Peter
     48 Cooper's [Ruby Weekly](http://rubyweekly.com/) newsletter, though the
     49 project was started in April 2010. Before anything else, you have to
     50 admit that the project homepage looks pretty nice, and I'm happy to
     51 report that that same attention to aesthetics carries into the project
     52 itself. Configuration files for each model in the admin interface are
     53 written in Ruby and live in `app/admin`. It's clear that a lot of
     54 thought has gone into the configuration API, and the [Github
     55 page](https://github.com/gregbell/active_admin) contains thorough
     56 documentation for how to use it.
     57 
     58 I've long been jealous of [Django](https://www.djangoproject.com/)'s
     59 generated admin interfaces, and ActiveAdmin is the first Rails project
     60 I've seen that can rival it in terms of overall slickness, both from a
     61 UI and development standpoint. The trouble with libraries that give you
     62 so much out of the box is that it's often difficult to do things that
     63 the author's didn't anticipate, and I'd need to spend more than an hour
     64 with ActiveAdmin in order to determine if that's the case here.
     65 
     66 ### RailsAdmin
     67 
     68 [RailsAdmin](https://github.com/sferik/rails_admin) is another recent
     69 entry into the admin interface generator space, beginning as a Ruby
     70 Summer of Code project in August of last year. I had some difficulty
     71 getting it installed, finally having success after pointing the Gemfile
     72 entry at the GitHub repository
     73 (`gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'`).
     74 The signup process was similarly unpolished, outsourcing entirely to
     75 [Devise](https://github.com/plataformatec/devise) to the point that
     76 anyone can navigate to `/users/sign_up` in your application and become
     77 an admin.
     78 
     79 Once inside the admin interface, things seem to work pretty well.
     80 There's some interesting functionality available for associating models,
     81 and the dashboard has some neat animated graphs. I'll be curious to
     82 watch this project as it develops --- if they can smooth off some of the
     83 rough edges, I think they'll really have something.
     84 
     85 ### Conclusion
     86 
     87 [ActiveAdmin](http://activeadmin.info/) offers an incredibly slick
     88 out-of-the-box experience; [Typus](https://github.com/fesplugas/typus)
     89 seems to offer more ways to override default behavior. If I was starting
     90 a new project today, it would depend on how much customization I thought
     91 I'd have to do through the life of the project as to which library I
     92 would choose. I put a small project called
     93 [rails_admin_interfaces](https://github.com/dce/rails_admin_interfaces)
     94 on GitHub with branches for each of these libraries so you can try them
     95 out and draw your own conclusions.