ActiveModel classes have a class method .human_attribute_name. This returns a human-readable form of the attribute: Person.human_attribute...
tl;dr Do not use the option optional on association declarations with a symbol, lambda or proc. Explanation Association declarations...
This card describes four variants, that add a more intuitive workflow when working with nested attributes in Rails + Unpoly:
We are using assignable_values for managing enum values in Rails. Nevertheless Rails is adding more support for enum attributes...
Postgres works differently See PostgreSQL: Difference between text and varchar columns for PostgreSQL-specific info MySQL has 4 different column...
Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...
tl;dr Prefer request specs over end-to-end tests (Capybara) to joyfully test file downloads! Why? Testing file downloads
You can chain multiple Capybara matchers on the page or any element: expect(page) .to have_content('Example Course')
These are the top ten accessibility errors as researched by TPGi, a company focusing on accessibility. See the linked article...
Today I stumbled across a pretty harmless-looking query in our application which turned out to be pretty harmful and...
All browsers implement an event named beforeunload. It is fired when the active window is closed and can be used...
A Rails script lives in lib/scripts and is run with bin/rails runner lib/scripts/.... They are a simple tool to perform...
There are a few tools to combat the dreaded n+1 queries. The bullet gem notifies you of missing eager...
Tested on Ubunut 22.04 1. Opener script Create a file ~/.local/bin/coverage_zip_opener with: #!/bin/bash tmp_folder="/tmp/coverage-report-opener" if [ -z "$1" ]
The linked article suggests an interesting way to speed up tests of Rails + Postgres apps: PostgreSQL allows the creation of...
A general overview about why and how we migrate can be found under Migrating from Elasticsearch to Opensearch
#pluck is commonly used as a performant way to retain single database values from an ActiveRecord::Relation Book.pluck(:title, :price...
If you ever need to restore exact records from one database to another, Marshal might come in handy. Marshal.dump is...
The sprintf method has a reference by name format option: sprintf("% d : % f", { :foo => 1, :bar => 2 }) # => 1 : 2.000000
While upgrading CarrierWave from version 0.11.x to 3.x, we encountered some very nasty fails. Below are the basic...
Given you have an array column like this: create_table "users", force: :cascade do |t| t.integer "movie_ids", default: [], array...
Besides Plotting graphs in Ruby with Gruff, which comes handy for many uses cases, you sometimes might need configuration for...
Both knapsack and parallel_tests have the option to split groups by historic execution time. The required logs for this...
For my computer science bachelor's thesis I programmed and evaluated a CLI Test Case Prioritization (TCP) tool for makandra...