wave
Uncategorized

10 Essential & Useful Ruby on Rails 4 Gems.

Mohammed Naser

Mohammed Naser

The Ruby on Rails framework is an extremely powerful tool for developing web applications. It comes with plenty of built-in features that help accelerate the development of your web application such as intelligent routing and an object-relation mapper, all using an MVC pattern.

Rails are designed in a way to be very easily extended using Ruby gems. This has created a large ecosystem of Ruby gems that can extend your application and accelerate your development process even more by reducing the time involved in working in developing common functionality. We’re going to go over a few gems which we consider to be very useful.

Devise

Devise is most probably the most commonly used Gem when using Ruby on Rails. It provides an easy-to-use authentication solution for your Rails application which will allow you to get login, registration, forget the password, account locks and much more account-related features by simply using this Gem.

Pundit

It’s important to know the distinction between authentication and authorization. The device helps authenticate users and verify who they are while authorization ensures that the user is allowed to perform an action or access a resource. Pundit takes care of this entire process by providing a simple way of defining authorization systems using nothing but Ruby classes.

Slim

There are many template systems out there. Ruby on Rails uses the eRuby template system by default, however, it’s typically something that users will choose to replace. Slim is a common replacement because it allows you to maintain very easy to read templates due to it’s simple syntax while maintaining very fast compilation times.

Draper

Draper allows you to build decorators around your models. It helps make your views much cleaner and lets you avoid writing helpers. Instead of procedurally calling helpers with models, you instead define a decorator which wraps the original model and provides a list of extended method and attributes to your object.

Cells

You’ll often re-use many components of your application. Typically, partials are used for this type of behaviour however you must make sure that your controllers that call the parts all have consistent behaviour. Cells allow you to take parts of your controller and encapsulate them into their own little controller. This helps make your code much cleaner and avoid the long helper/partial/filter mes.

FriendlyId

Typically, resource URLs are identified by their primary key which is usually their database ID. However, this can result in unoptimized web page URLs that are not user-friendly to read either. FriendlyId can easily transform your URLs too much friendlier and easy to remember URLs for little to no code changes in your web application.

Simple Form

Forms are at the heart of every single web application. If there is any level of interaction with the user, it typically is done using a web form. Simple Form helps simplify this very simple yet repetitive task. By implementing a simple and easy to use DSL for building forms, you can spend less time writing HTML for your forms and more time on the core business logic of your application.

Paperclip

File attachments are never easy to work with. They typically involve a significant amount of work to implement and even more time to make sure that they are implemented in a very secure manner. Paperclip takes care of this entire process for you inside your Rails application and extends it even more to things like transforming images to thumbnails and much more.

Kaminari

Kaminari is not a very descriptive name for a Gem, however, it is one of the most popular Gems with almost 5 million downloads. It enables you to paginate anything from ActiveRecord relations to simple arrays using a clean, easy to use and simple scope-based API which is fully agnostic to whatever ORM or template engine you use.

Sidekiq

There are many choices for background processing tools when using Ruby on Rails, however, Sidekiq is one of the most popular ones. The reason behind its popularity is the simplicity of its API and how it scales much better than other background processors.

Would you like to know about Zuul, a CI/CD project gating tool? Download our white paper and get reading!

How to up your DevOps game with Project Gating

Share on Social Media:

OpenStack

Cluster API driver for OpenStack Magnum

Mohammed Naser

Public Cloud

9000 MTUs (jumbo frames) in all Public Cloud Regions

Mohammed Naser

Uncategorized

OpenInfra Summit Berlin 2022 VEXXHOST Recap

Mohammed Naser

Go to Top