Rails' url_for is useful for generating routes from a Hash, but can lead to an open redirect vulnerability.

Rails' Strong Parameters enable you to allow only specific values from request params to e.g. avoid mass assignment.

In CI test runs I noticed that string sorting order changed after switching from a debian-based PostgreSQL docker image...

TL;DR: Grid elements have min-width: auto in a 1fr column, which may lead to overflows. With minmax(0...

Sometimes you'll find yourself with a set of tasks that require similar code for different models. For example, if...

Using querySelector or querySelectorAll in JavaScript, you can easily find descendants of a node that match a given selector.

It most cases it's not necessary to add a version constraint next to your gems in the Gemfile. Since...

Code splitting is a feature of esbuild that can keep huge libraries out of the main bundle. How code splitting...

Within Vim do the following: Move cursor to the first starting line where you want to start editing

With this Ruby script you can print all values in a Redis database to your console (derived from this bash...

Looking at the source code of the validates_numericality_of validator, it becomes clear that it converts the attribute in...

When you allow file uploads in your app, a user might upload content that hurts other users. Our primary concern...

You have an async function that rejects: async function failingFunction() { throw new Error("Something went wrong") } When you call that...

In Ruby on Rails ActiveRecord::Relation#merge overwrites existing conditions on the same column. This may cause the relation to...

blog.mastermind.dev

I found the linked article very helpful to refresh my understanding of database indexes. As a small bonus, it includes...

Capybara has a variety of finder methods like find_button to help you look up DOM elements. There are also...

Usually you add errors to :base in ActiveRecord, in case no appropriate attribute could be used to add the error...

Maintaining larger projects makes it more difficult to balance refactoring and upgrade tasks according to its actual value. Consider to...

Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...

By default most exceptions in Rails will render a 500 error page and will create a new issue in your...

Rails Active Support provides some helpful methods for calculating times and dates, like Duration#ago or Duration#from...

Rails offers the fresh_when method to automatically compute an ETag from the given record, array of records or scope...

By activating strict_loading you force developers to address n+1 queries by preloading all associations used in the index...

The change_column method for rails migrations support casting with a custom SQL statement. This allows us to change a...