For Rails models where only one of multiple attributes may be filled out at the same time, there is no...

Ruby has two different ways to match the start and the end of a text: ^ (Start of line) and $ (End...

We are using assignable_values for managing enum values in Rails. Nevertheless Rails is adding more support for enum attributes...

When two classes implement the same behavior (methods, callbacks, etc.), you should extract that behavior into a trait or module...

If the project team consists of at least 2 members, do a daily standup. It should not take much longer...

It is very common to parse dates from strings. It seems obvious to use Date.parse for this job. However this...

In the past we validate and set default values for boolean attributes in Rails and not the database itself.

CarrierWave comes with a set of default configuration options which make sense in most cases. However, you should review these...

makandra dev

Postgres supports multiple built-in range datatypes: int4range int8range numrange tsrange (range with timestamp without timezone) tstzrange (range with timestamp...

makandra Curriculum

Understand how nested attributes appear in the params. See how the Rails form helpers encode the names of nested...

Action Mailer Basics and Previews Chapter "Task H1: Sending Confirmation Emails" from Agile Web Development with Rails (in our...

With Ubuntu 24.04 it's not longer possible to setup FDE with BTRFS The new installer won't offer you...

There are several ways to run a single spec. I usually copy the spec file path with the line number...

Learn to store attachments in a way that is accessible by authorized users only Learn to prevent users from...

unpoly.com

Version 3.7.0 broke some things in complex forms. Sorry for that. Concurrent user input is hard. 3.7.1 This change fixes...

makandra dev

There is a practical short list for valid/invalid example email addresses - Thanks to Florian L.! The definition for valid emails...

tl;dr Do not use the option optional on association declarations with a symbol, lambda or proc. Explanation Association declarations...

Since Rails 7 you are able to encrypt database information with Active Record. Using Active Record Encryption will store an...

If validations failed for a record, and you want to find out if a specific validation failed, you can leverage...

Use form models to handle this problem Or soften the validation to validates_presence_of :parent

validates_acceptance_of :terms only works if terms is set to a value. The validation is skipped silently when terms...

In Ruby you can communicate between processes with sockets. This might be helpful in tests that validate parallel executions or...

This is a personal post-mortem analysis of a project that was mainly build to provide a REST API to...

If you require your Rails models manually, pay attention to the path you use. Unless you have...