8 Ruby Gems We're Loving
8 Ruby Gems We're Loving
Looking for a few good gems? How about eight? We take a look at eight gems that the folks over at Planet Argon are crazy about! Do you agree with the list?
Join the DZone community and get the full member experience.Join For Free
Learn how to add document editing and viewing to your web app on .Net (C#), Node.JS, Java, PHP, Ruby, etc.
We’re nearly halfway through 2018 now (it sounds crazy to put it like that, right?) and with that comes a new list of our Rails development team’s favorite Ruby gems of 2018! Just like last time, all of these gems have been put through the ringer, used in a client application, and come with an official Argonista stamp of approval. Check them out:
John Cech, Backend Developer
Timecop – Time-Based Testing
Timecop is used to control dates and times for tests. making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call. With this Ruby gem, you’re able to freeze time, travel back to a specific point in time and move forward from that point, and scale time at a more accelerated pace. Best of all, this gem has no dependencies and can be used with any Ruby project. Its great documentation solves a tricky problem while writing specs.
Bullet – Performance Improvement
The bullet gem identifies areas where N+1 queries are happening and helps you improve your Rails app’s performance by reducing the number of queries it makes. Bullet keeps an eye on your queries as you’re developing an application and notifies you when you should add eager loading, or when you’re using eager loading that is not necessary in the app.
Corinne Kunze, Front-End Developer
Ransack – Search Form Creation
Ransack enables the creation of both simple and advanced search forms for your Ruby on Rails application. It’s unique in the sense that it allows you to search in Rails without needing to integrate with more complex querying solutions like thinking Sphinx or Elasticsearch. It works really well for simple search functionality because it will utilize ActiveRecord to query through your database.
Webpacker – Asset Manager via Webpack
Fast JSON API - Serialize Ruby Code to JSON
When you need to serialize your Ruby code to JSON, typically we will use a gem called ActiveModelSerializers. This gem allows you to serialize to a bunch of other formats, but 99% of the time I just need to serialize to JSON. Fast JSON API is much faster than active model serializers but works in a similar way.
Scott Dudley, Backend Developer
Pundit Matchers – Pundit Testing
This Ruby gem makes testing the Pundit gem much cleaner and easier – specifically the Permitted Attributes methods from Pundit which can be painful. Pundit Matchers does require that both the rspec-rails and pundit gems are also installed.
John Guest, Full-Stack Developer
IceNine – Deep Freeze Objects
While you can create unchangeable structures in Ruby by calling
freeze, this doesn’t deep freeze the data structure – Ruby doesn't have built-in support for deep freezing objects. This tiny library provides a very straightforward way to do so. Also, I love the Kurt Vonnegut reference.
Nate McGregor, Ruby on Rails Intern
pry – Debugging
Pry is an alternative to the standard IRB shell for Ruby, and it includes source code and doc browsing, syntax highlighting, command shell and Gist integration, and more. This Ruby gem makes debugging a Rails app so much easier.
There are hundreds of Ruby Gems out there, so choosing the best one for your Rails project can feel like looking for a needle in a haystack. A good place to start looking for the gem that will best solve your issue is Awesome Ruby which sorts gems by functionality. Once you find a promising one, a web search will likely pull up StackOverflow, Medium, and blog post entries related to the gem that will key you in on weaknesses, issues, and success stories from other developers.
What Ruby gems have you tried so far this year that have impressed you? Leave a comment below and let us know.
Published at DZone with permission of Erica Tafavoti , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.