Ruby on Rails Gems We Love

A look at the gems we use most often and why we love them.
Chris Young
Chris Young
August 13, 2022

We love Ruby on Rails and we love the community that supports it. Not only do we find the core framework is a joy to work with, but we also have a handful of Gems that we are quick to add to any project that we work on. We've noticed that over the years this list has changed -- but not that much.

Below we'll take a quick look at the Gems we love to use within our Rails projects, how we make use of them and why you should consider trying them out in your project.

The Gems

Gem Description
vite_rails We have migrated all of our projects off of Webpacker to Vite. We've found that Vite is not only faster in development and production but that it helps with our DX by offering simple and effective page reload on code changes and hot module reloading within stimulus. We've moved everything to esbuild for development and production which has greatly helped with dev/prod parity.
acts_as_list We often run into managing lists in our apps. That includes ordering, re-ordering, inserting and removing. This gem makes it very easy to facilitate drag and drop reordering in a couple of lines of code. Scoping lists has been a life saver and allows lists to exist within the context of a parent element.
discard Discard makes soft-delete easy. We use this virtually everywhere and have ingrained the use of .kept in our development process. Yes, every once in a while we miss the scope and return all objects, however, we find that the explicit scope keeps our ActiveRecord interactions clean and understandable.
letter_opener This gem makes checking emails easy. Now, with the more recent versions of Rails there are some other mail preview features, but we have found letter_opener serves us incredibly well. Adding letter_opener_web works perfectly with our Docker-based development workflow.
pagy Like you, we've moved around between all of the main pagination libraries over the years. We've stuck to pagy for several years now. The interface is nice, it has great integration with Bootstrap and it is fast! We couldn't ask for more in a pagination library.
bootstrap_form This is something we do want to revisit, but it is a gem that we have used on every major project that we've delivered in the past several years. This gem makes generating Bootstrap forms easy, including error messages and layouts.
view_component Newer to our repertoire but an invaluable tool to create encapsulated, reusable components within our code. We love this one so much that we created a set of metrics widgets that leverage ahoy and called it matey.
noticed Sending notifications is a staple of applications and noticed makes it a breeze to handle different types of notifications (email, in app, slack etc..) in a clean and scalable way.
pretender Multi-tenant, multi-role applications were a huge pain to debug in years past. It was a matter of creating known passwords and doing a lot of sign in and sign out. With pretender, it is really simple to add the ability to switch between users. We typically build in a support role that has the ability to become users and build in icons liberally to make it convenient to become any user on any page.
pundit This is one of the first gems we add to a project (right after devise) to support specific authorization policies. We've had great luck with this gem, its ability to keep authorization logic out of controllers and a consistent way to check both individual records and scopes.
audited Just like discard, we usually include audited liberally into our models. Having the ability to track all changes over the lifespan of a record proves very helpful for support and security stakeholders. We typically create a partial to generically render all of the audit activities associated with a record and then simply include it in views as appropriate.
authtrail Tracking login activity is also very helpful for support and security stakeholders. authtrail makes capturing this easy and automatically captures loads of helpful information with respect to user logins (and failed logins).
ahoy_matey We use this gem to track basic application metrics and events. We use it A LOT. We've found it to be a very effective tool for not only tracking a great deal of usage statistics but also to help track generic event data for in-app business processes.
groupdate Thanks to this gem, we are blissfully unaware of how to efficiently group things by date (in psql). Grouping by day, week, month etc.. is all a matter of adding an extension to a query.

How We Pick Gems

There is a lot to this process in terms of both qualitative and quantitative aspects. Below we'll capture some of the main things that we consider when selecting gems.

  1. Community. We believe in numbers and we respect and appreciate that we have a huge community of really smart peers. We mostly frequently discover new gems from one of two places; blog posts or newsletters like Ruby Weekly and Hotwire dev newsletter.
  2. Project Health. Once we find a project that looks interesting and either solves a need or gives us a way to wow users, we then dig into the backing GitHub project to see the state of the code. At a very high level, we're looking at issue open/close rate, code freshness and generally the "tone" of the participants.
  3. Does it Work! Well, "work" is very overloaded in this context, but is it easy to get the gem integrated, does the interface feel right and does it play nicely with the rest of our application. This is an oddly artsy piece of the puzzle but ultimately results in our go/no-go in using the gem.

Your Gems?

Have a gem that you love to use in your projects? We'd love to hear about it!

If you are interested in not only telling us about the gems you love, but joining our team to make use of them then please have a look at our open positions!.

About the author

Chris Young

Chris is dedicated to driving meaningful change in the world through software. He has taken dozens of projects from napkin to production in fast yet measured way. Chris has experience delivering solutions to clients spanning fortune 100, not-for-profit and Government.