What are Ruby on Rails Gems?

Ruby on Rails uses freestanding chunks of functionality aptly named “Gems”.  The idea is that often required functionality is “gemified” so that it can added to future projects effortlessly. Rails developers are a sociable bunch who share their Gems for others to use and add further enhancements to. Once shared, a gem belongs to the Rails community.

Some Gems become staples and even if the original creator is now sitting on a tropical beach, the Rails community ensure that it continues to evolve. Conversely, other Gems don’t stand the test of time and fall by the wayside.

The Top 5 RoR Gems that we use

Here are five Gems that MindVision has chosen to use over several years and recommends to all Rails developers.

Devise Gem – for Authentication

Devise Gem on Github

Devise is a complete authentication tool, for achieving a flexible configurable “user” system. The sheer popularity of the Devise Gem within the Ruby on Rails community creates one of its biggest benefits. Thousands of developers using and contributing to a tool means many eyes ensuring secure operation and safe defaults.

Devise offers:

  • User registration, handling the sign-up, removal and editing of user accounts.
  • Hashed user passwords that keep passwords secure even if a database is compromised. The hashed passwords use industry best practice to keep them secure.
  • User account confirmation emails to verify email addresses.
  • Recovery procedures. Standard ways to reset the user password, using their email to give them reset instructions.
  • Remembering user accounts with the standard “remember me” button in user cookies.
  • User tracking of when they last signed in with time stamp and IP address.
  • User account protection to disable an account after a number of failed login attempts.

CanCanCan Gem – for Authorisation (Permissions)

CanCanCan on Github

The CanCanCan Gem is for authorisation. Authorisation is the act of working out what the current user can see and do within an application. This differs from Authentication which is identification of a user.

CanCanCan is so popular in the rails community, that when the original developer of it disappeared, it was quickly forked and maintained for the public to keep using. It is highly configurable, robust and powerful. CanCanCan is a staple in any project and has become the defacto for anyone implementing an enterprise grade authorisation model.

Rack Mini-Profiler Gem – for performance optimisation

Rack Mini-Profile on Github

 Premature optimization is the root of all evil — DonaldKnuth

Premature optimisation is a bad idea. But when a developer optimises, they need to be well equipped to identify “real” problems and bottlenecks. Rack Mini Profiler is the tool for the job.

Rack Mini Profiler presents a small status window on the top left of a views window with useful detail on the page loading. It can be configured in production to give live feedback for quick identification of bottlenecks to be optimised.

Ruby on Rails lends itself to rapid development to keep up in a fast-paced world where new features are constantly demanded. A powerful profiler exposes the real bottlenecks and avoids guesswork by the programmer.

Draper Decorators Gem – for tidy code

Draper Decorators Gem on Github

The Draper Decorators Gem is used to separate presentation logic from models. Logic mixed within a model makes the code harder to maintain. MindVision makes heavy use of decorators so that model data is easily accessible and found when required and all pages are consistent.

Simple Form Gem – for fast efficient form creation

Simple Form Gem on Github

Simple Form is almost a must. It’s too nice not to have! Creating a form becomes quick and efficient with the Simple Form Gem. No working out field types or how it should be displayed. Simple Form identifies the type of data a field should have and generates a standard input for the user.

Simple Form will get it right most of the time without help. But if you need visual customisation or complex inputs you can mix in the standard form helpers that Rails provides.

Check out the MindVision Custom Software Services

Pin It on Pinterest

Share This