There’s nothing more frustrating than waiting for that last test or CI pipeline to finish, only for it to flake out. This decreases confidence in your test suite, increases spend on CI pipeline runtime, and decreases engineering happiness. Feature tests are especially prone to flakiness, as they rely on directly interacting with the application UI and browser. Adding JavaScript into the mix only…
I’ve been using Ruby for over 11 years now and along the way I’ve discovered many favorite methods that I keep coming back to. Many of my favorites come from the Enumerable module. I love the simplicity of finding a standard method that does the exact data manipulation. Being able to share these methods with other engineers is fun in of itself. So without further ado, here’s some excellent Ruby…
I’ve been working heavily with RabbitMQ message broker infrastructure recently to coordinate events between two Rails applications. The event work involves maintaining synchronized data between specific shared data. In the past, I’ve implemented a find_or_create_by style of idempotent backfilling required associations. Today I learned about a separate syntax via create_with for presetting record…
Today, I learned that ActiveModel::Api is the minimal implementation for an object to act like a model. ActiveModel::Model was the standard prior to Rails 7. You can still use it but it implies additional model-esque functionality where as API is the bare bones interface.
I love to customize my development environment. Between operating system, editor, and terminal, I’m always reading through the configuration options to improve my workflow. Getting it to look pretty is also great since I spend so much time working with these tools. This article details my current setup for crafting a perfect terminal with Zsh, Antidote, Oh My Zsh, Powerlevel10k, and Mise.
Today, I learned that Rails 8 introduced a new ActionController::Parameters method called expect. This allows for cleaner and safer parameter permission and requiring. I must have just missed this in the documentation, but what a nice quality-of-life feature to add.
Today I learned you can specify PostgreSQL functions within a Ruby on Rails migrations. I found this particularly useful for setting a random default value for a database column. Let’s dig into a simple example of this concept.
Today I learned about the after function for scheduling side effects which avoid blocking execution. Think of it as a simple background job scheduler. These are much lighter than a database or Redis backed queueing infrastructure. That being said, I’m still learning what the benefits vs. costs might be for this Next.js version 15 update.
I’ve been working with Prisma as an object-relational mapping tool for my projects. Coming from a background of using raw SQL along with ActiveRecord, I’ve noticed that default Prisma caters to JavaScript over other established standards. Ensuring database table columns are snake_case along with creating associations that are lowercase and plural doesn’t come for free but Prisma does provide a way…
If you’ve worked with Rails for any measure of time, then you know that Rails’ Views can quickly get out of hand. Between Helpers, instance variables, and inline logic, they quickly become bloated and tightly coupled to other view specific logic. Pushing these concerns into the Controller layer, or even a Presenter helps, but still lands the View in a place where it contains multiple…