My favorite Ruby gems
I’m always hesistant when it comes to using gems. Every gem you add to a project is a bit of added risk, what if it contains a security bug? What if the developers stop maitaining it? What if it doesn’t work with the next Ruby version? Of course, building everything yourself is not an option either. Through the years I’ve built a list of gems I trust and use. So far I’ve never shared these anywhere public. I’m changing that with this post.
Authentication and authorization
-
Authentication with features like locking, forgot password, remembering sign in.
-
A much clearer manner of authorizing users when compared to cancan.
-
Split your application data in “tenants”, which could be seperate customers, domains, etc.
Output generation
-
Generate Markdown to HTML.
-
A template language built by Shopify. Great for customizable webhook implementations for example.
-
Fast and simple JSON serializer with a simple DSL. See my previous post about JSON serializers.
-
A very fast and simple xlsx file generator using a C library, that doesn’t consume much memory.
-
A more extensive xlsx file generatore (pure Ruby). It has more features than fast_excel, but that comes at a cost: slower and more memory usage.
Payments
-
The official Mollie Ruby gem.
-
The official Stripe Ruby gem.
Testing
-
Mocking and stubbing
-
Compare hashes and show the differences in a simple language. Great when testing JSON API responses.
-
Stop execution and start debugging on an interactive console.
-
Test with real browsers.
Various
-
Implement an Excel like formula system in your application. Great for giving users some computational data access.
-
Cocoon implements the frontend parts of nested forms for you.
-
Read Excelsheets, OpenDocument spreadsheets and csv files.
-
Linting and other techniques to improve your code quality.
Note that I’ve never built a project with all these gems in it. I always try to keep the dependencies to a minimum to avoid headaches when upgrading gems or the server operating system.