Best Ruby Gems We Use

Nov 30
13:15

2016

ievgencherksahyn

ievgencherksahyn

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

In our Ruby kitchen we cook web applications. What makes our apps savory is the Ruby gems: useful libraries that offer diverse solutions for common problems in web application development. We’ve selected 46 useful gems that we regularly use and would like to recommend to you!

mediaimage

Here at RubyGarage we work closely with Ruby and Ruby on Rails technologies. If we imagine our workflow as a kitchen where we “cook” applications,Best Ruby Gems We Use Articles we might say that our developers are chefs, Ruby is our cookbook, and Ruby on Rails is our partially-prepared food: it’s half cooked, so we don’t need to do everything from scratch. Finally, we “season” our apps with gems – Ruby libraries with specific functionalities. Gems allow us to extend and customize our apps.

For this article, we’ve selected the top Ruby gems we regularly use in our projects – and recommend. Enjoy!

Active Record

Active Record is the default ORM for Ruby on Rails. Though it offers rich functionality, some projects require custom solutions or additional features. We’ve picked out a few gems that extend Active Record’s functionality making it more powerful, flexible, and versatile.

Pagination – For pagination, try a gem with the enigmatic name Kaminari, Japanese for “thunder.” Kaminari is a flexible out-of-the-box paginator (no configuration required) that uses scopes to handle ActiveRecord queries.

Categorization – To implement better classification and structuring of data on a blog, a news website, or a social network, you might want to add tags. The gem ActsAsTaggableOn allows you to tag objects (models and controllers) according to several attributes depending on your application’s content.

Clone – If you need to create a copy of an Active Record object and its associations, look at the gem deep_cloneable, which adds a method to objects to copy themselves. Deep_cloneable gives you an accurate copy with minimal effort.

Soft delete – Paranoia, which replaces acts_as_paranoid, implements a soft delete function. After you call destroy on an Active Record object, Paranoia doesn’t destroy those records in the database. Instead, this gem hides the object by scoping queries on a model. You need to use really_destroy to really destroy a Rails object.

Finite state machines – AASM, which replaces the theacts_as_state_machine plugin, works with any Ruby object including ActiveRecord. AASM adds finite state machines (sets of rules that dictate what an application or a device should do) to Ruby classes.

Versioning – The PaperTrail gem enables you to prevent frustrating situations when you can’t undo or redo changes to your models. With PaperTrail, you can version your models, add, undo, and redo behavior, restore data, work with model associations, and more.

Internationalization – When it comes to translating your application into foreign languages, Globalize, powered by I18n API, comes in handy. Globalize adds translations of your website’s content to ActiveRecord models, which is especially useful when you deal with translation of non-static database content.

Originally published here