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

  • devise

    Authentication with features like locking, forgot password, remembering sign in.

  • pundit

    A much clearer manner of authorizing users when compared to cancan.

  • acts_as_tenant

    Split your application data in “tenants”, which could be seperate customers, domains, etc.

Output generation

  • redcarpet

    Generate Markdown to HTML.

  • liquid

    A template language built by Shopify. Great for customizable webhook implementations for example.

  • blueprinter

    Fast and simple JSON serializer with a simple DSL. See my previous post about JSON serializers.

  • fast_excel

    A very fast and simple xlsx file generator using a C library, that doesn’t consume much memory.

  • caxlsx_rails

    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

Testing

  • mocha

    Mocking and stubbing

  • hashdiff

    Compare hashes and show the differences in a simple language. Great when testing JSON API responses.

  • byebug

    Stop execution and start debugging on an interactive console.

  • capybara

    Test with real browsers.

Various

  • dentaku

    Implement an Excel like formula system in your application. Great for giving users some computational data access.

  • cocoon

    Cocoon implements the frontend parts of nested forms for you.

  • roo

    Read Excelsheets, OpenDocument spreadsheets and csv files.

  • rubocop

    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.