27 Ruby Gems I use in almost every project
Tags: rails, ruby, javascript
Published: 2017-03-21 21:33:58

---
title: 27 Ruby Gems I use in almost every project
published: true
description: The Rails community thrives on its open source gems. Implementing a well written, well tested and vetted gem can make the difference between days and weeks of development of new features. Not every gem is great, but I wanted to share a list of gems that I have used on nearly every recent project I have worked on.
cover_image: https://cdn-images-1.medium.com/max/1600/1*s5nP6mBILnJi1YqVTDBaeg.png
tags: ruby on rails, ruby, rails, javascript
---

### ...and pretty much can't live without

The Rails community thrives on its open source gems. Implementing a well written, well tested and vetted gem can make the difference between days and weeks of development of new features.

Not every gem is great, but I wanted to share a list of gems that I have used on nearly every recent project I have worked on.

***

Note: This article is an excerpt from a chapter in my upcoming book [Building a SaaS Ruby on Rails on Rail 5](https://buildasaasappinrails.com). The book will guide you from humble beginnings through deploying an app to production. If you find this type of content valuable, the book is on pre-sale right now!

***

Here are the 27 gems:

- **[aasm](https://github.com/aasm/aasm)** - Formerly, acts_as_state_machine. This gem will help you handle state management on complicated or heavily branched workflows. Particularly when you are dealing with Stripe or other objects that may go through a pipeline of stages.
- **[lodash-rails](https://github.com/rh/lodash-rails)** - LoDash is very helpful in adding enumerable functions to javascript and in most cases of Rails applications, CoffeeScript.
- **[local_time](https://github.com/basecamp/local_time)** - This is a gem that includes a view helper and javascript helper to display relative time (i.e. 'updated 2 minutes ago'). Not only will it format the string, but will update the string on the client side as time goes on.
- **[devise](https://github.com/plataformatec/devise) and [devise_invitable](https://github.com/scambra/devise_invitable)** - Devise is the authentication library most used in Rails for the past few years. While there are some up and coming libraries to provide authentication services, the support around Devise and it's ease of use make it great to move quickly on your SaaS application. Devise Invitable is an add-on gem that will allow you to have an invitation system to have users invite other users to your application.
- **[rolify](https://github.com/RolifyCommunity/rolify) and [cancancan](https://github.com/CanCanCommunity/cancancan)** - Rolify allows the application to assign roles such as User or Admin on a User object. Then CanCanCan allows you to take those roles and apply authorization policies.
- **[paper_trail](https://github.com/airblade/paper_trail)** - This will allow you to set up audit logs on particular models so you can see what users made a change. Using that information to be displayed within your application in an activity log or just used as a way to troubleshoot changes.
- **[ranked-model](https://github.com/mixonic/ranked-model)** - Allows quick ordering and sorting of sibling elements. Instead of using a sequential position integer, it uses big numbers to sort faster.
- **[bootstrap-sass](https://github.com/twbs/bootstrap-sass)** - Allows you to use the Bootstrap HTML/CSS framework to quickly build a usable interface for the application.
- **[friendly_id](https://github.com/norman/friendly_id)** - Used in obfuscating the auto-incremented primary ID used in rails objects from the URL.
- **[slim-rails](https://github.com/slim-template/slim-rails)** - Instead of using HTML markup with Ruby code embedded, Slim is another templating language that allows you to write simple markup, without the need for closing tags. For example:

```html
<%- if @user.admin? %>
  <h1>Welcome back admin</h1>
<%- else %>
  <h1>Welcome back pal</h1>
<%- end %>
```

...would become
```ruby
- if @user.admin?
  h1
    | Welcome back admin
- else
  h1
    | Welcome back pal
```

- **[Sidekiq](https://github.com/mperham/sidekiq)** - This gem allows you to run background jobs, backed by a Redis queue. Instead of running tasks like sending emails on the main request loop. You can drop it into a Sidekiq job to run in the background.
- **[kaminari](https://github.com/kaminari/kaminari)** - This gem handles pagination and it's edge cases. It also includes templates that already work with Bootstrap.
- **[paperclip](https://github.com/thoughtbot/paperclip) and [aws-sdk](https://github.com/aws/aws-sdk-ruby)** - Combined these two gems will allow you to upload assets such as avatar images through your application into AWS S3.
- **[money-rails](https://github.com/RubyMoney/money-rails)** - This will help standardize around common issues found when calculating money as well well providing a few template helpers.
- **[ransack](https://github.com/activerecord-hackery/ransack)** - A search abstraction that will allow you to create simple forms that can search through tables. Such as a search form on a users index page.
- **[slack-notifier](https://github.com/stevenosloan/slack-notifier)** - Simple Slack API integration tool to quickly send a message to a Slack Webhook. Tiy can use this to send notifications to your own Slack when a new user signs up or in other areas. You may use more in-depth gems if more than Webhook integrations are needed with Slack.
- **[premailer-rails](https://github.com/fphilipe/premailer-rails)** - This helps with CSS inclusion into mail templates. Gmail will commonly break email templates based on how they can ignore included CSS. This gem automatically merges styles into the markup tags to work in Gmail.
- **[griddler](https://github.com/thoughtbot/griddler)** - This tool allows you to parse email received through a mail sending API. I have used this gem with its Sendgrid companion gem, but you can choose other email providers as well.
- **[rollbar](https://github.com/rollbar/rollbar-gem)** - This gem allows you to send exceptions to a third-party exception aggregator. Otherwise, you would need to set up your own exception notification process or spend all your time watching Rails' logs.
- **[rspec-rails](https://github.com/rspec/rspec-rails), [factory_girl_rails](https://github.com/thoughtbot/factory_girl_rails), [simplecov](https://github.com/colszowka/simplecov)** - I personally like to use RSpec over the default Rails test framework. I find it easier and quicker to reason about model factories over fixtures for the more complex model associations. SimpleCov is an easy way to keep track of your test coverage.
- **[letter_opener](https://github.com/ryanb/letter_opener)** - This gem will open mail in the browser instead of attempting to send mail in the development environment.
- **[rack-cors](https://github.com/cyu/rack-cors)** - This gem will help set up CORS rules. This will be of use if accessing JSON requests from domains that are not the current Rails' app configured domain name. This is helpful if at any point a request from front-end code is sent to your Rails application.

Those are my pick for gems, what are yours?