Top 19 Ruby gems you can’t miss in 2018
It took us three long years to give you an update on the Ruby gems our devs find the most useful or simply fun in their work. But, well, here it is. We are extremely pleased to bring you the list of gems you simply cannot miss in 2018.
Bearing in mind that you are here and reading this post, I presume you are no stranger to the world of Ruby-on-Rails and know the term “gem” pretty well. If, for some reason you need a reminder, just check our Ruby Gem Guide, containing the list of our favorite gems from 2015. But life goes on, and the universe of Ruby has welcomed several valuable additions, while seeing other gems go. This is why I decided to ask the Prograils developers about their top Ruby gems they have been using in 2018. What are they and what kind of magic do they do? Let us see!
A gem enabling fast insertion of bulks of records.
activerecord-import follows activerecord associations and generates the minimal number of SQL insert statements required, avoiding the N+1 insert problem. As the plain ActiveRecord may work fine when uploading ten, but not hundreds or thousands of records, this gem is extremely useful when importing external data. Simply said,
activerecord-import reduces the conversion time significantly.
primary provides an easy way to mark a record as "primary" (or "active", "selected", etc.) for a given scope. If your site has, for instance, several languages, this one will choose one of them as the default one.
This plugin allows us to gradually roll out features to selected users.
4. Pry, Pry-Rails, Pry-Byebug, Pry-Remote
A must-have set of gems for any Rails developer that makes debugging a pleasure.
pry is written from scratch in order to ensure a number of advanced features including source code browsing, syntax highlighting, live hel system and a wide range of plugins providing remote sessions and full debugging functionality.
5. Wicked PDF
A gem that generates PDF files from Rails templates. Instead of dealing with some PDF generation DSL, you simply write a Rails view as you would normally and then let
wicked_pdf take care of the rest.
This one handles nested forms and has already replaced the long-undeveloped
nested_form gem. Nested forms are forms that handle nested models and attributes in one form; e.g. a project with its tasks or an invoice with its line items. Compatible with Rails 3, 4 and 5.
A REST-like API framework for Ruby. It's designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs.
This is a Make-like program implemented in Ruby with tasks and dependencies specified in standard Ruby syntax. You notice the Make reference with R for Ruby instead of “M”, right?
Provides integration with webpack and yarn in your Rails app. The main purpose of
Designed to increase an application's performance by reducing the number of queries it makes. Bullet keeps an eye on them while the app is being developed and will notify you whenever eager loading (N+1 queries) is required, or when it isn't necessary and when counter cache should be used.
There are many reasons for you to have this ace up your sleeve, actually.
geocoder performs multiple functions. Thanks to it, you can both forward and reverse geocoding as well as an IP address geocoding. What is more, it connects to more than 40 APIs worldwide. Thanks to an advanced configuration, you will be able to use different parameters and APIs under various conditions. Features like caching will definitely enhance your app’s performance.
geocoder integrates with ActiveRecord and Mongoid. Its basic geospatial queries include search within radius, rectangle or ring.
This one lets you record your test suite's HTTP interactions and replay them later during future test runs. Profits? Fast, deterministic, accurate tests.
The main function of ParallelTests is separation of tests into even groups (be it by number of lines or runtime) and running each group in a single process with its own database.
A framework for building automated deployment scripts. Although written in Ruby,
capistrano can be used to deploy projects of any language or framework. Rails? Java? PHP? You name it. When installed, this gem gives you a ‘cap’ tool for deployments straight from your command line.
15. Bundler Audit
"Patch-level verification for Bundler" - as its creators describe. Enough said.
16. Shoulda Matchers
As guys from Thoughtbot, who have created this gem, put it:
shoulda-matchers provides RSpec- and Minitest-compatible one-liners that test common Rails functionality. These tests would otherwise be much longer, more complex, and error-prone’.
This one is a utility library which enables the login functionality as button for admin. If you want to test your multi-user app functionally by using a login of an existing user, though without asking them for the password - all you have to do is define login as a button with url helper and use it.
In order to schedule jobs at specified times,
sidekiq-cron runs a thread alongside all Sidekiq workers. It checks for new jobs to schedule every 30 seconds without scheduling the same job multiple times. Jobs are added only when at least one Sidekiq process is being run.
Allows the Ruby-on-Rails ActiveRecord model records to be organized as a tree structure (or hierarchy). While using the materialized path pattern, it uses a single database column. All the standard tree structure relations can be fetched in a single SQL query. Other features? “STI support, scopes, depth caching, depth constraints easy migration from older gems, integrity checking, integrity restoration, arrangement of (sub)tree into hashes and different strategies for dealing with orphaned records”.
Last but not least: a huge “thank you” to Michał Buszkiewicz, Maciej Litwiniuk, Piotr Boniecki, Przemysław Nikratowicz and Piotr Wasiak for their valuable contribution to this post.
- Three ways of iterating over tree-like ActiveRecord structures
- Capistrano deploy to ubuntu, with systemd, nginx/puma and rbenv
- Learn more about our values, process and technologies. This is our playbook
Photo by Johnson Wang/Unsplash.com