Popular Ruby Gems
These are the most popular gems that i have used at some point, when building web applications with ruby on rails. These features and functionalities can also be added from scratch without using any ruby gems, but using ruby gems is a much better, faster and practical way to implement those features and functionalities in web applications.
Authentication is a necessary feature in most modern web applications. For authentication, there are a few popular gems that gets the job done, all of them use somewhat common methods and techniques to achieve this. Devise is the most popular one and is widely used, but there are other gems as well, check them out if you haven’t. Here’s how to use devise.
- Devise: https://github.com/heartcombo/devise
- Doorkeeper: https://github.com/doorkeeper-gem/doorkeeper
- Omniauth: https://github.com/omniauth/omniauth
- Authlogic: https://github.com/binarylogic/authlogic
For authorization, pundit and cancancan are the most popular ones, because they are quick and easy to use. Here’s my tutorial on how to use pundit for authorization.
- Pundit: https://github.com/varvet/pundit
- Cancancan: https://github.com/CanCanCommunity/cancancan
- Rolify: https://github.com/RolifyCommunity/rolify
- Authority: https://github.com/nathanl/authority
Pagination is must, kaminari and will pagniate are quick and and easy to implement, but much slower than pagy, pagy is a lot faster than any pagination gem, but it requires additional steps to setup and is more complicated to implement. Here’s my tutorial on how to use kaminari for pagination.
- Will paginate: https://github.com/mislav/will_paginate
- Kaminari: https://github.com/kaminari/kaminari
- Pagy: https://github.com/ddnexus/pagy
Tagging is a must have feature for any blogging type of a web apps, this can be done with a couple of gems like “acts as votable” or with “guten tag”.
- Acts as taggable on: https://github.com/mbleigh/acts-as-taggable-on
- Gutentag: https://github.com/pat/gutentag
For voting or adding like/dislike feature i have used only this gem so far. Here’s a tutorial on how to use acts as votable to add likes/dislike feature to your app.
- Acts as votable: https://github.com/ryanto/acts_as_votable
For activity logging i have found only “public activity” gem, that works the way i expected activity logs to function. See this tutorial on how to use activity logger.
- public activity: https://github.com/chaps-io/public_activity
For file uploads, we have a variety of gems, with it’s own unique features, some are easy to use while others require advanced methods. Also some support direct uploads, and some don’t. And if you wan to use Active storage, it already comes with rails6 by default, you just have to run a few migrations and enable it.
- paperclip: https://github.com/thoughtbot/paperclip
- shrine: https://github.com/shrinerb/shrine
- carrierwave: https://github.com/carrierwaveuploader/carrierwave
- refile: https://github.com/refile/refile
- active storage: https://www.rubydoc.info/gems/activestorage/0.1
To add search functionality to your rails apps, ransack is the easiest to implement. Search gems also comes with modern search features like autocomplete, indexing, caching, etc. Here’s a tutorial on how to use ransack to add search.
- searchkick: https://github.com/ankane/searchkick
- ransack: https://github.com/activerecord-hackery/ransack
- elasticsearch-rails: https://github.com/elastic/elasticsearch-rails
For Background Processing, i have used sidekiq and delayed job, each of them have it’s own features and disadvantages as well.
- Sidekiq: https://github.com/mperham/sidekiq
- Resque: https://github.com/resque/resque
- Delayed Job: https://github.com/collectiveidea/delayed_job
For deployments or automatic deployments, capistrano is a great gem that makes everything easier to deploy on any type of server or even multiple servers, cloud instances or containers with just a few steps.
- capistrano: https://github.com/capistrano/capistrano
If you want to quickly add an admin panel to your rails app, without manually constructing it from scratch. You can use gems like active admin and rails admin.
- ActiveAdmin: https://github.com/activeadmin/activeadmin
- rails_admin: https://github.com/sferik/rails_admin
There are a lot of database types and gems, but here’s the most popular ones. Sqlite3 already comes with rails, but it’s not practical to use it in production so i recommend either pg or mysql for production use.
- pg: https://github.com/ged/ruby-pg
- sqlite3: https://github.com/sparklemotion/sqlite3-ruby
- mysql: https://github.com/brianmario/mysql2
So, these were some of the popular gems that i have use when building web applications with ruby on rails. In future i will be adding more gems to this list. So, that’s all folks, have a nice day.