Marko Anastasov wrote this on September 21, 2011

admin_view: minimal admin interface generator for your Rails 3 models

We’ve released the first version of admin_view, a gem that adds a minimal admin interface generator for your models. It works with Rails 3 and gives you a controller, views and specs, with an assumption that you’re authenticating users with Devise.

For example, if you type:

bundle exec rails g admin_view User --search_by name

you’ll get something like this:

The search form is powered by meta_search, and you can easily tweak it to cover more columns. You also get sortable columns, and screens to CRUD individual records.

The markup is bare bones, and this is on purpose - our only guideline was that it should look good with the Railscasts stylesheet, which we use for admin interface in all our applications.

Subscribe to gem updates on RubyGems or watch the repo to stay up-to-date on future improvements.


admin_view generates code (not much), because in our practice one size can’t fit all. We always need to be able to change something about the default, scaffold-like stuff: tweak which columns go in the listing table, how admin creates a new record (if at all), what editing means (if at all), how data in the show action is connected to other records etc.

But we need to have a starting point that works, and is covered by specs. So if we need something special, we can quickly write a Cucumber scenario, and make it all green. We’re dealing with basic Rails stuff there, so change is rapid, and there’s no additional API to memorize. For these reasons, something like active_admin is not what we need.


Packaging the generator as a Rails 3 gem was challenging. We had to examine the source code of various plugins and Rails itself in order to figure out the naming conventions, and how the tests can be set up (that’s one reason we’re releasing this now and not in January when the first commit went in). I’m still hoping to enhance the tests to include one temporary model as a basis for testing views.

The source is small and it can be a reference to anyone who wants to implement a Rails 3 generator plugin as a gem. Here are some links that we found useful:

comments powered by Disqus

About Marko Anastasov

Rendered Text co-founder. Started with code, currently more focused on people and words. Foosball striker and entry-level cyclist.

Suggested Reads

Rails Testing Handbook

A new ebook on building test-driven Rails apps with RSpec and Cucumber.

At Rendered Text, we have a long history with Ruby on Rails. Checking the blog archive reminds me that we published first posts about working with Rails way back in 2009.


Rendered Text is a software company. For questions regarding Semaphore, please visit Otherwise, feel free to get in touch any time by sending us an email.