Systems | Development | Analytics | API | Testing

Ruby

Manage Your Ruby Logs Like a Pro

Logs are essential to any application's development. Most Ruby logs are verbose and chunky, so digging for exactly what you need can be difficult. Even though they contain useful information, you might not get as much value as you should from logs if you don't know how to use them effectively. In this article, we'll explore: Let's get started.

How to Load Code in Ruby

There are many ways to load code and access file-related constants in Ruby. We can create a clear architecture by separating and handling concerns into classes and pulling in only the classes we depend on. Many full-stack frameworks like Rails and Hanami offer a built-in method to access the classes we want, as long as we stick with a certain convention. How does this work? In this post, we will explore three different options for loading code: using load, require, and autoload.

How to Use the rodauth-omniauth Gem in Ruby

Setting up authentication for your Ruby app is important to ensure it is secure. In this post, we'll explore the rodauth-omniauth gem for Ruby to implement authentication in your app via third-party providers. First, let's quickly define authentication before exploring the benefits of OmniAuth and setting up the rodauth-omniauth gem for a Rails app. Let's dive straight in!

Unlocking the Power of Lambdas in Ruby

Lambdas are a powerful feature of the Ruby language. They allow you to wrap logic and data into a portable package. In this post, we’ll cover how and when to use lambdas. You'll also learn about the difference between lambdas and Procs, and the performance profile of lambda functions. The code examples have been tested with 2.6 and 2.7 and should work with most modern Rubys. Use the links below to skip ahead in the tutorial.

Diving into Custom Exceptions in Ruby

Customizing exceptions is usually not a common concern during software development. But if you catch an error in an observability tool and can't correctly and quickly identify the problem, you may need more information and details about an exception. This article will show you how to customize exceptions in Ruby and mitigate potential future problems due to a lack of error information. Let's dive straight in!

Authorization Gems in Ruby: Pundit and CanCanCan

Today, many web applications will feature pages that are publicly available — like a homepage — and more secure ones where a user has to log in to get access. The process of user registration, logging in, and tracking user session state is called "authentication". At the same time, when dealing with logged-in users, it's necessary to separate actions and resources that are available to them depending on their user roles. For example, "admins" generally have more access than normal users.