UseFul Ruby Gems, priceless!

Jessica Lee
5 min readAug 24, 2021
Ruby

Since I have been learning Ruby, I started to learn the basic SQL. and then after I have learn ‘Active Record’ and ‘Rake’ after that, that helps me whole lot easier to work on the project. That’s why I was curious about the gems and would like to learn more about those besides the basic gems I already know (Rake, Sinatra, ActiveRecord).

Ruby gems & bundler

Devise

Designed for User_authentication, Omniauthable, password and so on. This will be the best solutions for authentication in Ruby on Rails. It’s extendable, flexible and easy. Highly recommended. it allows you to have multiple models signed in at the same time, Is a complete MVC solution based on Rails engines.

Devise_link : https://github.com/heartcombo/devise

CanCanCan

CanCanCan is an authorization library for Ruby and Ruby on Rails which restricts what resources a given user is allowed to access. All permissions can be defined in one or multiple ability files and not duplicated across controllers, views, and database queries, keeping your permissions logic in one place for easy maintenance and testing

CanCanCan_link : https://github.com/CanCanCommunity/cancancan

Chartkick

can get awesome data views that being passed as columns, libraries, acoounts, different type of charts. Visibly looks good, easy to use.

Examples Using Charkick

Cartkick_link : https://chartkick.com/

Annotate

When creating models in rails, this gem is actually annotate what they are. Instead of searching our schema, or datatype in the database, Whenever we migrate the data, it will update it automatically, you can easily check it with one line command ‘rake routes’

Examples Using Annotate

Annotate_link : https://github.com/ctran/annotate_models/

FriendlyId

Great ways to make our urls, app pretty. Actually you can get scope called “friendly” and use that to our database. It all happens behind the scenes but it’s pretty handy. FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for Active Record. It lets you create pretty URLs and work with human-friendly strings as if they were numeric ids.

Examples Using FriendlyId

FriendlyId_link : https://github.com/norman/friendly_id/

MetaTags

MetaTags is helpful adding bulk of the stuff, title and description attribute for SEO. A lot of customized options to choose, and this is the gem to make our rails application SEO-friendly.

MetaTags_link : https://github.com/kpumuk/meta-tags/

Impressionist

If you want to get some impression, you can use this gem. especially when user clicking, submitting, and so on. It can log page impressions (technically action impressions), but it is not limited to that. You can log impressions multiple times per request. And you can also attach it to a model. The goal of this project is to provide customizable stats that are immediately accessible in your application as opposed to using Google Analytics and pulling data using their API. You can attach custom messages to impressions. No reporting yet.. this thingy just creates the data

Impressionist_link : https://github.com/charlotte-ruby/impressionist/

Draftsman

Easy to use, straightforward like boolean. extendible. there are built-in method that easily use. Draftsman is a Ruby gem that lets you create draft versions of your database records. If you’re developing a system in need of simple drafts or a publishing approval queue, then Draftsman just might be what you need.

Draftsman_link : https://github.com/copasetickid/draftsman

Pay

new gem for payment process. uses a brain tree and stripe as a the payment engines. there are actual configurations like invoices, receipts and emails. There will be charge to use it.

Logo for Pay gem

Pay_link : https://github.com/pay-rails/pay

MailCatcher

MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that’s arrived so far.

Example of MailCatcher

MailCatcher_link : https://github.com/sj26/mailcatcher/

RedCarpet

Great tool for backend for markdown driven form. built-in methods what allows us to customise what you doo render and what you don’t. Straightforward to use. The core of the Redcarpet library is the Redcarpet::Markdown class. Each instance of the class is attached to a Renderer object; the Markdown class performs parsing of a document and uses the attached renderer to generate output.

The Redcarpet::Markdown object is encouraged to be instantiated once with the required settings, and reused between parses.

RedCarpet_link : https://github.com/vmg/redcarpet/

ActsAsVotable

This gem allows any model to be voted on, like/dislike, upvote/downvote, etc. and it also allows any model to be voted under arbitrary scopes. In other words, votes do not have to come from a user, they can come from any model (such as a Group or Team). This provide an easy to write/read syntax.

Example code of ActAsVotable

ActAsVotable_link : https://github.com/ryanto/acts_as_votable/

Unread

This gem manages unread records for anything you want readers (e.g. users) to read (like messages, documents, comments etc.) It supports mark as read to mark a single record as read and also supports mark all as read to mark all records as read in a single step. It gives you a scope to get the unread records for a given reader. we needs only one additional database table.

Unread_link : https://github.com/ledermann/unread/

Conclusion

I will move on to Rails later on, These gems should be extremely helpful when I work on my project next time. Practices make me perfect. Let’s keep working!!

--

--