How to Add an Admin Dashboard to a Rails API using the Administrate Gem

A quick guide on adding an adnmin dashboard to a Rails app using the Administrate gem.

What’s an admin dashboard?

Admin dashboards provide a GUI for your Rails app that allow you to perform CRUD (create, read update, delete) actions on your database.
Admin Dashboards can be a nice alternative to the console, and a great way for endusers to edit records.
Administrate dashboard example

Why I Chose the Administrate Gem

After some research, the most discussed gems I noticed were: activeadmin, rails_admin, and administrate. I also found a blog post with the ominous title “Get Rid of Your Admin Gem”… which I took into consideration when making my decision.

The author covers activeadmin & rails_admin specifically, citing the main issues as not following “the rails way” and bloat. This made me think: Something different than MVC (model, view, controller) in my Rails app and a DSL (domain specific language) to learn? Yuck, no thanks!

Yuck Reaction Gif

My thoughts on DSLs & no MVC

But what about administrate? Let’s take a look at their Github readme:

To accomplish these goals, Administrate follows a few guiding principles:

  • No DSLs (domain-specific languages)
  • Support the simplest use cases, and let the user override defaults with standard tools such as plain Rails controllers and views.
  • Break up the library into core components and plugins, so each component stays small and easy to maintain.

Sounds awesome and covers the concerns mentioned above!

Other things that stood out:

It also doesn’t hurt that administrate is created by ThoughtBot, the people behind amazing gems like Factorygirl & Paperclip.

Setting up Administrate

Github: https://github.com/thoughtbot/administrate
Documentation: https://administrate-prototype.herokuapp.com/

The process is covered well in the documentation, so to to avoid reinventing the wheel, I’ll just cover any anomalies here.

Tips

Thoughts

Administrate is awesome! Utilizing generators and MVC(huge plus!) makes setup & customization simple & familiar.