Reading Time: 6 minutes
Ruby on Rails is great for its gems. We have picked up our favorites to share them with you. Check out 19 Ruby gems that amaze us inside.
Ransack gem offers a very easy and nice-to-use API for search. It works well to build simple and straightforward search forms for all types of Ruby on Rails applications. It is designed as a quick and easy solution for regular functionality. If you need an advanced search form, you should probably build it manually using ActiveRecords scopes.
Pry is an IRB alternative and runtime developer console. It makes debugging process much more user-friendly, which makes Rubyroid Labs Team happier. With its help, one can look the stop point in code directly from the terminal. Going to next place in code is also done nicely. Integration with the Awesome-print gem is a good cherry top.
After Ryan Bates take a pause on his cancan project, pundit becomes our primary choice when dealing with authorization. Our team like a lot of how it leverages regular Ruby classes and object-oriented design patterns. Pundit doesn’t use any meta-magic and based on plain Ruby objects, which makes it very accessible yet very efficient, especially for Ruby on Rails beginners.
4. Active Model Serializers
ActiveModelSerializers gem is designed to bring convention over configuration to your JSON generation.em with the help of two components: serializers and adapters. We prefer this gem over others since it has nice DSL and gives you a great speed of serialization by class. If you have any problems with slow JSON rendering by jbuilder, you should definitely try this out.
5. Devise Masquerade
Devise Masquerade is a real treasure for those, who use Devise gem. With its help, one can log in as another User, which significantly simplifies debugging process and lets system admins have everything under control.
6. Wicked PDF
When dealing with generating PDF files from HTML code, we don’t have too many alternatives in our community. But we have admitted that wicked_pdf does a great job there.Wicked PDF strong sides are flexible configuration and integration with JS and CSS. This gem is easy to add and configure so it will save you a lot of effort. Since wicked_pdf is wrapper for wkhtmltopdf tool and you need it to be installed, we recommend to add it with wkhtmltopdf-binary-edge to keep version the same for all team members.
7. Letter Opener
Letter Opener is a grand library for developers, which allows emulating and automatically looking through the sent emails in the browser. This means you do not need to set up email delivery in your development environment and don’t have to worry about sending any test emails by accident.
Writing HTML email can be a real pain. Though roadie won’t save you from all troubles, it will at least do all inline stylesheets and rewriting relative URLs for you. This way your day as a developer will become a bit brighter with a roadie on your side.
9. Sitemap Generator
A sitemap is one of the basic things for SEO optimization.
So if you want your website to be googled easily you wouldn’t do without a proper sitemap. This gem will not only create a sitemap with all available for search links but will also notify search engines once something is updated.
VCR gem records your test suite’s HTTP interactions and then replays them during future test runs. This makes the whole debugging process much more efficient since with VCR you use real service replies instead of making them up yourself. So you have a more realistic picture.
Sometimes, especially when dealing with external legacy APIs over network, you requests can fail without any particular reason. And best what you can do here is repeat your request a few times and pray that it will work. This is not hard logic and every developer can write this himself, but our team will better use retryable and save couple hours for our clients. This gem provides simple API for this, where everything which runs in block will be retried when an exception occurs.
Carrierwave is probably one of the most popular Ruby on Rails gem for images processing. It allows creating image copies in the size required with minimum effort required from a developer side. Flexible settings make it suitable almost for any business need.
Groupdate is designed to group certain events by time period. With its help, one can get statistics on any action for any time gap set. For example, you can find out how many users registered yesterday or how many units of the product have been sold from the start of the year. Easy API make this nice gem even nicer.
By the way, it has Groupdate gem built-in, so you have nothing to worry about.
Apartment is a minimalistic gem that provides extended database multi-tenancy. It is great for the cases like when you need to have some data sequestered based on account or company, but you still want these data to exist in a common tenant. It provides all the functionality required together with easy-to-use- logic.
16. Money Rails
Money Rails is a perfect gem for an eCommerce project with some currency conversion.
Money Rails is out of box solution with a wide range of functionality, which makes it suitable for almost any app. API is flexible, simple and easy-to-integrate with whatever you need.
17. Rack Attack
Rack Attack gem is your Avengers Team in the battle against DDoS-attacks. It contains a large number of instruments to fight against some basic attacks such as picking up passwords and simple DDoS.
You can protect your website using safelisting, blocklisting, throttling, and tracking based on arbitrary properties of the request.
18. Friendly ID
Friendly ID gem generates a friendly slug (URL part that is used as ID), which makes links more personalized and nicer to use. It is easy to set up and is actively supported by the community. It remembers slug history, saves pages for search engine and provides high flexibility of slug generation strategy.
GeoCoder is very easy yet very efficient tool, which provides easy address search by IP, geo-coordinates or place name. It is quick, simple and comes with its goals just fine.
Hope you will find this list helpful. And what are your favorite gems? Share with us in the comments.
(Featured on Awesome Ruby)